Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Avoid error when trying to delete links and images
Browse files Browse the repository at this point in the history
  • Loading branch information
brrd committed Oct 6, 2017
1 parent 8f6b4f3 commit 54adaf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/renderer/cm-extend-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

/* jshint esversion: 6 */
// TODO: support multiple selections
// TODO: reverse images and links

const styles = require.main.require("./cm-markdown-styles.js");

Expand Down Expand Up @@ -35,6 +34,8 @@ module.exports = function (CodeMirror) {
};

const removeInlineStyle = (style) => {
if (!style.reversible || style.delimiter == null) return;

const getDelimiter = (pos, classname, step) => {
const getNextMove = (pos, step) => {
const lineLength = this.getLine(pos.line).length;
Expand Down
4 changes: 3 additions & 1 deletion app/renderer/cm-markdown-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ const styles = {
},
image: {
type: "inline",
classname: "image",
set: ({text, anchor, head}) => ["![", text, "](", anchor, "http://", head, ")"]
},
link: {
link: { // TODO: delete links
type: "inline",
classname: "link",
set: ({text, anchor, head}) => {
if (text.length === 0) {
return ["[", anchor, text, head, "](http://)"];
Expand Down

0 comments on commit 54adaf8

Please sign in to comment.