Browse Source

update editor style

zhuzhuyule 8 years ago
parent
commit
ed50d33cef

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "HexoEditor",
   "name": "HexoEditor",
-  "version": "1.2.12",
+  "version": "1.3.14",
   "description": "This is markdown editor for Hexo.",
   "description": "This is markdown editor for Hexo.",
   "main": "app/index.js",
   "main": "app/index.js",
   "scripts": {
   "scripts": {

+ 0 - 148
views/main/CodeMirror/gfm_math.js

@@ -1,148 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-/*
- *  This file is part of Moeditor.
- *
- *  Copyright (c) 2016 Menci <huanghaorui301@gmail.com>
- *
- *  Moeditor is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  Moeditor is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with Moeditor. If not, see <http://www.gnu.org/licenses/>.
- */
-
-(function(mod) {
-  if (typeof exports == "object" && typeof module == "object") // CommonJS
-    mod(require("../../../node_modules/codemirror/lib/codemirror"), require("./markdown_math"), require("../../../node_modules/codemirror/addon/mode/overlay"));
-  else if (typeof define == "function" && define.amd) // AMD
-    define(["../../../node_modules/codemirror/lib/codemirror", "./markdown_math", "../../../node_modules/codemirror/addon/mode/overlay"], mod);
-  else // Plain browser env
-    mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-var urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i
-
-CodeMirror.defineMode("gfm_math", function(config, modeConfig) {
-  var codeDepth = 0;
-  function blankLine(state) {
-    state.code = false;
-    return null;
-  }
-  var gfmOverlay = {
-    startState: function() {
-      return {
-        code: false,
-        codeBlock: false,
-        ateSpace: false
-      };
-    },
-    copyState: function(s) {
-      return {
-        code: s.code,
-        codeBlock: s.codeBlock,
-        ateSpace: s.ateSpace
-      };
-    },
-    token: function(stream, state) {
-      state.combineTokens = null;
-
-      // Hack to prevent formatting override inside code blocks (block and inline)
-      if (state.codeBlock) {
-        if (stream.match(/^```+/)) {
-          state.codeBlock = false;
-          return null;
-        }
-        stream.skipToEnd();
-        return null;
-      }
-      if (stream.sol()) {
-        state.code = false;
-      }
-      if (stream.sol() && stream.match(/^```+/)) {
-        stream.skipToEnd();
-        state.codeBlock = true;
-        return null;
-      }
-      // If this block is changed, it may need to be updated in Markdown mode
-      if (stream.peek() === '`') {
-        stream.next();
-        var before = stream.pos;
-        stream.eatWhile('`');
-        var difference = 1 + stream.pos - before;
-        if (!state.code) {
-          codeDepth = difference;
-          state.code = true;
-        } else {
-          if (difference === codeDepth) { // Must be exact
-            state.code = false;
-          }
-        }
-        return null;
-      } else if (state.code) {
-        stream.next();
-        return null;
-      }
-      // Check if space. If so, links can be formatted later on
-      if (stream.eatSpace()) {
-        state.ateSpace = true;
-        return null;
-      }
-      if (stream.sol() || state.ateSpace) {
-        state.ateSpace = false;
-        if (modeConfig.gitHubSpice !== false) {
-          if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) {
-            // User/Project@SHA
-            // User@SHA
-            // SHA
-            state.combineTokens = true;
-            return "link";
-          } else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) {
-            // User/Project#Num
-            // User#Num
-            // #Num
-            state.combineTokens = true;
-            return "link";
-          }
-        }
-      }
-      if (stream.match(urlRE) &&
-          stream.string.slice(stream.start - 2, stream.start) != "](" &&
-          (stream.start == 0 || /\W/.test(stream.string.charAt(stream.start - 1)))) {
-        // URLs
-        // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
-        // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine
-        // And then limited url schemes to the CommonMark list, so foo:bar isn't matched as a URL
-        state.combineTokens = true;
-        return "link";
-      }
-      stream.next();
-      return null;
-    },
-    blankLine: blankLine
-  };
-
-  var markdownConfig = {
-    underscoresBreakWords: false,
-    taskLists: true,
-    fencedCodeBlocks: '```',
-    strikethrough: true
-  };
-  for (var attr in modeConfig) {
-    markdownConfig[attr] = modeConfig[attr];
-  }
-  markdownConfig.name = "markdown_math";
-  return CodeMirror.overlayMode(CodeMirror.getMode(config, markdownConfig), gfmOverlay);
-
-}, "markdown_math");
-
-  CodeMirror.defineMIME("text/x-gfm_math", "gfm_math");
-});

+ 0 - 862
views/main/CodeMirror/markdown_math.js

@@ -1,862 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-/*
- *  This file is part of Moeditor.
- *
- *  Copyright (c) 2016 Menci <huanghaorui301@gmail.com>
- *
- *  Moeditor is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  Moeditor is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with Moeditor. If not, see <http://www.gnu.org/licenses/>.
- */
-
-(function(mod) {
-  if (typeof exports == "object" && typeof module == "object") // CommonJS
-    mod(require("../../../node_modules/codemirror/lib/codemirror"), require("../../../node_modules/codemirror/mode/xml/xml"), require("../../../node_modules/codemirror/mode/meta"));
-  else if (typeof define == "function" && define.amd) // AMD
-    define(["../../../node_modules/codemirror/lib/codemirror", "../../../node_modules/codemirror/mode/xml/xml", "../../../node_modules/codemirror/mode/meta"], mod);
-  else // Plain browser env
-    mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-CodeMirror.defineMode("markdown_math", function(cmCfg, modeCfg) {
-
-  var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
-  var htmlModeMissing = htmlMode.name == "null"
-
-  function getMode(name) {
-    if (CodeMirror.findModeByName) {
-      var found = CodeMirror.findModeByName(name);
-      if (found) name = found.mime || found.mimes[0];
-    }
-    var mode = CodeMirror.getMode(cmCfg, name);
-    return mode.name == "null" ? null : mode;
-  }
-
-  // Should characters that affect highlighting be highlighted separate?
-  // Does not include characters that will be output (such as `1.` and `-` for lists)
-  if (modeCfg.highlightFormatting === undefined)
-    modeCfg.highlightFormatting = false;
-
-  // Maximum number of nested blockquotes. Set to 0 for infinite nesting.
-  // Excess `>` will emit `error` token.
-  if (modeCfg.maxBlockquoteDepth === undefined)
-    modeCfg.maxBlockquoteDepth = 0;
-
-  // Should underscores in words open/close em/strong?
-  if (modeCfg.underscoresBreakWords === undefined)
-    modeCfg.underscoresBreakWords = true;
-
-  // Use `fencedCodeBlocks` to configure fenced code blocks. false to
-  // disable, string to specify a precise regexp that the fence should
-  // match, and true to allow three or more backticks or tildes (as
-  // per CommonMark).
-
-  // Turn on task lists? ("- [ ] " and "- [x] ")
-  if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
-
-  // Turn on strikethrough syntax
-  if (modeCfg.strikethrough === undefined)
-    modeCfg.strikethrough = false;
-
-  // Allow token types to be overridden by user-provided token types.
-  if (modeCfg.tokenTypeOverrides === undefined)
-    modeCfg.tokenTypeOverrides = {};
-
-  var tokenTypes = {
-    header: "header",
-    code: "comment",
-    math: "math",
-    quote: "quote",
-    list1: "variable-2",
-    list2: "variable-3",
-    list3: "keyword",
-    hr: "hr",
-    image: "image",
-    imageAltText: "image-alt-text",
-    imageMarker: "image-marker",
-    formatting: "formatting",
-    linkInline: "link",
-    linkEmail: "link",
-    linkText: "link",
-    linkHref: "string",
-    em: "em",
-    strong: "strong",
-    strikethrough: "strikethrough"
-  };
-
-  for (var tokenType in tokenTypes) {
-    if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
-      tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
-    }
-  }
-
-  var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
-  ,   ulRE = /^[*\-+]\s+/
-  ,   olRE = /^[0-9]+([.)])\s+/
-  ,   taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
-  ,   atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
-  ,   setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
-  ,   textRE = /^[^#!\[\]*_\\<>\$` "'(~]+/
-  ,   fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) +
-                                ")[ \\t]*([\\w+#\-]*)");
-
-  function switchInline(stream, state, f) {
-    state.f = state.inline = f;
-    return f(stream, state);
-  }
-
-  function switchBlock(stream, state, f) {
-    state.f = state.block = f;
-    return f(stream, state);
-  }
-
-  function lineIsEmpty(line) {
-    return !line || !/\S/.test(line.string)
-  }
-
-  // Blocks
-
-  function blankLine(state) {
-    // Reset linkTitle state
-    state.linkTitle = false;
-    // Reset EM state
-    state.em = false;
-    // Reset STRONG state
-    state.strong = false;
-    // Reset strikethrough state
-    state.strikethrough = false;
-    // Reset state.quote
-    state.quote = 0;
-    // Reset state.indentedCode
-    state.indentedCode = false;
-    if (htmlModeMissing && state.f == htmlBlock) {
-      state.f = inlineNormal;
-      state.block = blockNormal;
-    }
-    // Reset state.trailingSpace
-    state.trailingSpace = 0;
-    state.trailingSpaceNewLine = false;
-    // Mark this line as blank
-    state.prevLine = state.thisLine
-    state.thisLine = null
-    return null;
-  }
-
-  function blockNormal(stream, state) {
-
-    var sol = stream.sol();
-
-    var prevLineIsList = state.list !== false,
-        prevLineIsIndentedCode = state.indentedCode;
-
-    state.indentedCode = false;
-
-    if (prevLineIsList) {
-      if (state.indentationDiff >= 0) { // Continued list
-        if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
-          state.indentation -= state.indentationDiff;
-        }
-        state.list = null;
-      } else if (state.indentation > 0) {
-        state.list = null;
-      } else { // No longer a list
-        state.list = false;
-      }
-    }
-
-    var match = null;
-    if (state.indentationDiff >= 4) {
-      stream.skipToEnd();
-      if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) {
-        state.indentation -= 4;
-        state.indentedCode = true;
-        return tokenTypes.code;
-      } else {
-        return null;
-      }
-    } else if (stream.eatSpace()) {
-      return null;
-    } else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
-      state.header = match[1].length;
-      if (modeCfg.highlightFormatting) state.formatting = "header";
-      state.f = state.inline;
-      return getType(state);
-    } else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList &&
-               !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
-      state.header = match[0].charAt(0) == '=' ? 1 : 2;
-      if (modeCfg.highlightFormatting) state.formatting = "header";
-      state.f = state.inline;
-      return getType(state);
-    } else if (stream.eat('>')) {
-      state.quote = sol ? 1 : state.quote + 1;
-      if (modeCfg.highlightFormatting) state.formatting = "quote";
-      stream.eatSpace();
-      return getType(state);
-    } else if (stream.peek() === '[') {
-      return switchInline(stream, state, footnoteLink);
-    } else if (stream.match(hrRE, true)) {
-      state.hr = true;
-      return tokenTypes.hr;
-    } else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
-      var listType = null;
-      if (stream.match(ulRE, true)) {
-        listType = 'ul';
-      } else {
-        stream.match(olRE, true);
-        listType = 'ol';
-      }
-      state.indentation = stream.column() + stream.current().length;
-      state.list = true;
-
-      // While this list item's marker's indentation
-      // is less than the deepest list item's content's indentation,
-      // pop the deepest list item indentation off the stack.
-      while (state.listStack && stream.column() < state.listStack[state.listStack.length - 1]) {
-        state.listStack.pop();
-      }
-
-      // Add this list item's content's indentation to the stack
-      state.listStack.push(state.indentation);
-
-      if (modeCfg.taskLists && stream.match(taskListRE, false)) {
-        state.taskList = true;
-      }
-      state.f = state.inline;
-      if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
-      return getType(state);
-    } else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) {
-      state.fencedChars = match[1]
-      // try switching mode
-      state.localMode = getMode(match[2]);
-      if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
-      state.f = state.block = local;
-      if (modeCfg.highlightFormatting) state.formatting = "code-block";
-      state.code = -1
-      return getType(state);
-    }
-
-    return switchInline(stream, state, state.inline);
-  }
-
-  function htmlBlock(stream, state) {
-    var style = htmlMode.token(stream, state.htmlState);
-    if (!htmlModeMissing) {
-      var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
-      if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
-           (!inner.state.context && inner.state.tokenize.isInText)) ||
-          (state.md_inside && stream.current().indexOf(">") > -1)) {
-        state.f = inlineNormal;
-        state.block = blockNormal;
-        state.htmlState = null;
-      }
-    }
-    return style;
-  }
-
-  function local(stream, state) {
-    if (state.fencedChars && stream.match(state.fencedChars, false)) {
-      state.localMode = state.localState = null;
-      state.f = state.block = leavingLocal;
-      return null;
-    } else if (state.localMode) {
-      return state.localMode.token(stream, state.localState);
-    } else {
-      stream.skipToEnd();
-      return tokenTypes.code;
-    }
-  }
-
-  function leavingLocal(stream, state) {
-    stream.match(state.fencedChars);
-    state.block = blockNormal;
-    state.f = inlineNormal;
-    state.fencedChars = null;
-    if (modeCfg.highlightFormatting) state.formatting = "code-block";
-    state.code = 1
-    var returnType = getType(state);
-    state.code = 0
-    return returnType;
-  }
-
-  // Inline
-  function getType(state) {
-    var styles = [];
-
-    if (state.formatting) {
-      styles.push(tokenTypes.formatting);
-
-      if (typeof state.formatting === "string") state.formatting = [state.formatting];
-
-      for (var i = 0; i < state.formatting.length; i++) {
-        styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
-
-        if (state.formatting[i] === "header") {
-          styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
-        }
-
-        // Add `formatting-quote` and `formatting-quote-#` for blockquotes
-        // Add `error` instead if the maximum blockquote nesting depth is passed
-        if (state.formatting[i] === "quote") {
-          if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
-            styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
-          } else {
-            styles.push("error");
-          }
-        }
-      }
-    }
-
-    if (state.taskOpen) {
-      styles.push("meta");
-      return styles.length ? styles.join(' ') : null;
-    }
-    if (state.taskClosed) {
-      styles.push("property");
-      return styles.length ? styles.join(' ') : null;
-    }
-
-    if (state.linkHref) {
-      styles.push(tokenTypes.linkHref, "url");
-    } else { // Only apply inline styles to non-url text
-      if (state.strong) { styles.push(tokenTypes.strong); }
-      if (state.em) { styles.push(tokenTypes.em); }
-      if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
-      if (state.linkText) { styles.push(tokenTypes.linkText); }
-      if (state.code) { styles.push(tokenTypes.code); }
-      if (state.math) { styles.push(tokenTypes.math); }
-      if (state.image) { styles.push(tokenTypes.image); }
-      if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
-      if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
-    }
-
-    if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
-
-    if (state.quote) {
-      styles.push(tokenTypes.quote);
-
-      // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
-      if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
-        styles.push(tokenTypes.quote + "-" + state.quote);
-      } else {
-        styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
-      }
-    }
-
-    if (state.list !== false) {
-      var listMod = (state.listStack.length - 1) % 3;
-      if (!listMod) {
-        styles.push(tokenTypes.list1);
-      } else if (listMod === 1) {
-        styles.push(tokenTypes.list2);
-      } else {
-        styles.push(tokenTypes.list3);
-      }
-    }
-
-    if (state.trailingSpaceNewLine) {
-      styles.push("trailing-space-new-line");
-    } else if (state.trailingSpace) {
-      styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
-    }
-
-    return styles.length ? styles.join(' ') : null;
-  }
-
-  function handleText(stream, state) {
-    if (stream.match(textRE, true)) {
-      return getType(state);
-    }
-    return undefined;
-  }
-
-  function inlineNormal(stream, state) {
-    var style = state.text(stream, state);
-    if (typeof style !== 'undefined')
-      return style;
-
-    if (state.list) { // List marker (*, +, -, 1., etc)
-      state.list = null;
-      return getType(state);
-    }
-
-    if (state.taskList) {
-      var taskOpen = stream.match(taskListRE, true)[1] !== "x";
-      if (taskOpen) state.taskOpen = true;
-      else state.taskClosed = true;
-      if (modeCfg.highlightFormatting) state.formatting = "task";
-      state.taskList = false;
-      return getType(state);
-    }
-
-    state.taskOpen = false;
-    state.taskClosed = false;
-
-    if (state.header && stream.match(/^#+$/, true)) {
-      if (modeCfg.highlightFormatting) state.formatting = "header";
-      return getType(state);
-    }
-
-    // Get sol() value now, before character is consumed
-    var sol = stream.sol();
-
-    var ch = stream.next();
-
-    // Matches link titles present on next line
-    if (state.linkTitle) {
-      state.linkTitle = false;
-      var matchCh = ch;
-      if (ch === '(') {
-        matchCh = ')';
-      }
-      matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
-      var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
-      if (stream.match(new RegExp(regex), true)) {
-        return tokenTypes.linkHref;
-      }
-    }
-
-    // If this block is changed, it may need to be updated in GFM mode
-    if (ch === '`') {
-      var previousFormatting = state.formatting;
-      if (modeCfg.highlightFormatting) state.formatting = "code";
-      stream.eatWhile('`');
-      var count = stream.current().length
-      if (state.code == 0) {
-        state.code = count
-        return getType(state)
-      } else if (count == state.code) { // Must be exact
-        var t = getType(state)
-        state.code = 0
-        return t
-      } else {
-        state.formatting = previousFormatting
-        return getType(state)
-      }
-    } else if (state.code) {
-      return getType(state);
-    }
-
-    // Inline / display math
-    if (ch === '$') {
-      var previousFormatting = state.formatting;
-      state.formatting = "math";
-      stream.eatWhile('$');
-      var count = stream.current().length
-      if (state.math == 0) {
-        state.math = count
-        return getType(state)
-      } else if (count == state.math) { // Must be exact
-        var t = getType(state)
-        state.math = 0
-        return t
-      } else {
-        state.formatting = previousFormatting
-        return getType(state)
-      }
-    } else if (state.math) {
-      return getType(state);
-    }
-
-    if (ch === '\\') {
-      stream.next();
-      if (modeCfg.highlightFormatting) {
-        var type = getType(state);
-        var formattingEscape = tokenTypes.formatting + "-escape";
-        return type ? type + " " + formattingEscape : formattingEscape;
-      }
-    }
-
-    if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
-      state.imageMarker = true;
-      state.image = true;
-      if (modeCfg.highlightFormatting) state.formatting = "image";
-      return getType(state);
-    }
-
-    if (ch === '[' && state.imageMarker) {
-      state.imageMarker = false;
-      state.imageAltText = true
-      if (modeCfg.highlightFormatting) state.formatting = "image";
-      return getType(state);
-    }
-
-    if (ch === ']' && state.imageAltText) {
-      if (modeCfg.highlightFormatting) state.formatting = "image";
-      var type = getType(state);
-      state.imageAltText = false;
-      state.image = false;
-      state.inline = state.f = linkHref;
-      return type;
-    }
-
-    if (ch === '[' && stream.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, false) && !state.image) {
-      state.linkText = true;
-      if (modeCfg.highlightFormatting) state.formatting = "link";
-      return getType(state);
-    }
-
-    if (ch === ']' && state.linkText && stream.match(/\(.*?\)| ?\[.*?\]/, false)) {
-      if (modeCfg.highlightFormatting) state.formatting = "link";
-      var type = getType(state);
-      state.linkText = false;
-      state.inline = state.f = linkHref;
-      return type;
-    }
-
-    if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
-      state.f = state.inline = linkInline;
-      if (modeCfg.highlightFormatting) state.formatting = "link";
-      var type = getType(state);
-      if (type){
-        type += " ";
-      } else {
-        type = "";
-      }
-      return type + tokenTypes.linkInline;
-    }
-
-    if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
-      state.f = state.inline = linkInline;
-      if (modeCfg.highlightFormatting) state.formatting = "link";
-      var type = getType(state);
-      if (type){
-        type += " ";
-      } else {
-        type = "";
-      }
-      return type + tokenTypes.linkEmail;
-    }
-
-    if (ch === '<' && stream.match(/^(!--|\w)/, false)) {
-      var end = stream.string.indexOf(">", stream.pos);
-      if (end != -1) {
-        var atts = stream.string.substring(stream.start, end);
-        if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
-      }
-      stream.backUp(1);
-      state.htmlState = CodeMirror.startState(htmlMode);
-      return switchBlock(stream, state, htmlBlock);
-    }
-
-    if (ch === '<' && stream.match(/^\/\w*?>/)) {
-      state.md_inside = false;
-      return "tag";
-    }
-
-    var ignoreUnderscore = false;
-    if (!modeCfg.underscoresBreakWords) {
-      if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) {
-        var prevPos = stream.pos - 2;
-        if (prevPos >= 0) {
-          var prevCh = stream.string.charAt(prevPos);
-          if (prevCh !== '_' && prevCh.match(/(\w)/, false)) {
-            ignoreUnderscore = true;
-          }
-        }
-      }
-    }
-    if (ch === '*' || (ch === '_' && !ignoreUnderscore)) {
-      if (sol && stream.peek() === ' ') {
-        // Do nothing, surrounded by newline and space
-      } else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
-        if (modeCfg.highlightFormatting) state.formatting = "strong";
-        var t = getType(state);
-        state.strong = false;
-        return t;
-      } else if (!state.strong && stream.eat(ch)) { // Add STRONG
-        state.strong = ch;
-        if (modeCfg.highlightFormatting) state.formatting = "strong";
-        return getType(state);
-      } else if (state.em === ch) { // Remove EM
-        if (modeCfg.highlightFormatting) state.formatting = "em";
-        var t = getType(state);
-        state.em = false;
-        return t;
-      } else if (!state.em) { // Add EM
-        state.em = ch;
-        if (modeCfg.highlightFormatting) state.formatting = "em";
-        return getType(state);
-      }
-    } else if (ch === ' ') {
-      if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
-        if (stream.peek() === ' ') { // Surrounded by spaces, ignore
-          return getType(state);
-        } else { // Not surrounded by spaces, back up pointer
-          stream.backUp(1);
-        }
-      }
-    }
-
-    if (modeCfg.strikethrough) {
-      if (ch === '~' && stream.eatWhile(ch)) {
-        if (state.strikethrough) {// Remove strikethrough
-          if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
-          var t = getType(state);
-          state.strikethrough = false;
-          return t;
-        } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
-          state.strikethrough = true;
-          if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
-          return getType(state);
-        }
-      } else if (ch === ' ') {
-        if (stream.match(/^~~/, true)) { // Probably surrounded by space
-          if (stream.peek() === ' ') { // Surrounded by spaces, ignore
-            return getType(state);
-          } else { // Not surrounded by spaces, back up pointer
-            stream.backUp(2);
-          }
-        }
-      }
-    }
-
-    if (ch === ' ') {
-      if (stream.match(/ +$/, false)) {
-        state.trailingSpace++;
-      } else if (state.trailingSpace) {
-        state.trailingSpaceNewLine = true;
-      }
-    }
-
-    return getType(state);
-  }
-
-  function linkInline(stream, state) {
-    var ch = stream.next();
-
-    if (ch === ">") {
-      state.f = state.inline = inlineNormal;
-      if (modeCfg.highlightFormatting) state.formatting = "link";
-      var type = getType(state);
-      if (type){
-        type += " ";
-      } else {
-        type = "";
-      }
-      return type + tokenTypes.linkInline;
-    }
-
-    stream.match(/^[^>]+/, true);
-
-    return tokenTypes.linkInline;
-  }
-
-  function linkHref(stream, state) {
-    // Check if space, and return NULL if so (to avoid marking the space)
-    if(stream.eatSpace()){
-      return null;
-    }
-    var ch = stream.next();
-    if (ch === '(' || ch === '[') {
-      state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]", 0);
-      if (modeCfg.highlightFormatting) state.formatting = "link-string";
-      state.linkHref = true;
-      return getType(state);
-    }
-    return 'error';
-  }
-
-  var linkRE = {
-    ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
-    "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/
-  }
-
-  function getLinkHrefInside(endChar) {
-    return function(stream, state) {
-      var ch = stream.next();
-
-      if (ch === endChar) {
-        state.f = state.inline = inlineNormal;
-        if (modeCfg.highlightFormatting) state.formatting = "link-string";
-        var returnState = getType(state);
-        state.linkHref = false;
-        return returnState;
-      }
-
-      stream.match(linkRE[endChar])
-      state.linkHref = true;
-      return getType(state);
-    };
-  }
-
-  function footnoteLink(stream, state) {
-    if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
-      state.f = footnoteLinkInside;
-      stream.next(); // Consume [
-      if (modeCfg.highlightFormatting) state.formatting = "link";
-      state.linkText = true;
-      return getType(state);
-    }
-    return switchInline(stream, state, inlineNormal);
-  }
-
-  function footnoteLinkInside(stream, state) {
-    if (stream.match(/^\]:/, true)) {
-      state.f = state.inline = footnoteUrl;
-      if (modeCfg.highlightFormatting) state.formatting = "link";
-      var returnType = getType(state);
-      state.linkText = false;
-      return returnType;
-    }
-
-    stream.match(/^([^\]\\]|\\.)+/, true);
-
-    return tokenTypes.linkText;
-  }
-
-  function footnoteUrl(stream, state) {
-    // Check if space, and return NULL if so (to avoid marking the space)
-    if(stream.eatSpace()){
-      return null;
-    }
-    // Match URL
-    stream.match(/^[^\s]+/, true);
-    // Check for link title
-    if (stream.peek() === undefined) { // End of line, set flag to check next line
-      state.linkTitle = true;
-    } else { // More content on line, check if link title
-      stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
-    }
-    state.f = state.inline = inlineNormal;
-    return tokenTypes.linkHref + " url";
-  }
-
-  var mode = {
-    startState: function() {
-      return {
-        f: blockNormal,
-
-        prevLine: null,
-        thisLine: null,
-
-        block: blockNormal,
-        htmlState: null,
-        indentation: 0,
-
-        inline: inlineNormal,
-        text: handleText,
-
-        formatting: false,
-        linkText: false,
-        linkHref: false,
-        linkTitle: false,
-        code: 0,
-        math: 0,
-        em: false,
-        strong: false,
-        header: 0,
-        hr: false,
-        taskList: false,
-        list: false,
-        listStack: [],
-        quote: 0,
-        trailingSpace: 0,
-        trailingSpaceNewLine: false,
-        strikethrough: false,
-        fencedChars: null
-      };
-    },
-
-    copyState: function(s) {
-      return {
-        f: s.f,
-
-        prevLine: s.prevLine,
-        thisLine: s.thisLine,
-
-        block: s.block,
-        htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
-        indentation: s.indentation,
-
-        localMode: s.localMode,
-        localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
-
-        inline: s.inline,
-        text: s.text,
-        formatting: false,
-        linkTitle: s.linkTitle,
-        code: s.code,
-        math: s.math,
-        em: s.em,
-        strong: s.strong,
-        strikethrough: s.strikethrough,
-        header: s.header,
-        hr: s.hr,
-        taskList: s.taskList,
-        list: s.list,
-        listStack: s.listStack.slice(0),
-        quote: s.quote,
-        indentedCode: s.indentedCode,
-        trailingSpace: s.trailingSpace,
-        trailingSpaceNewLine: s.trailingSpaceNewLine,
-        md_inside: s.md_inside,
-        fencedChars: s.fencedChars
-      };
-    },
-
-    token: function(stream, state) {
-
-      // Reset state.formatting
-      state.formatting = false;
-
-      if (stream != state.thisLine) {
-        var forceBlankLine = state.header || state.hr;
-
-        // Reset state.header and state.hr
-        state.header = 0;
-        state.hr = false;
-
-        if (stream.match(/^\s*$/, true) || forceBlankLine) {
-          blankLine(state);
-          if (!forceBlankLine) return null
-          state.prevLine = null
-        }
-
-        state.prevLine = state.thisLine
-        state.thisLine = stream
-
-        // Reset state.taskList
-        state.taskList = false;
-
-        // Reset state.trailingSpace
-        state.trailingSpace = 0;
-        state.trailingSpaceNewLine = false;
-
-        state.f = state.block;
-        var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, '    ').length;
-        state.indentationDiff = Math.min(indentation - state.indentation, 4);
-        state.indentation = state.indentation + state.indentationDiff;
-        if (indentation > 0) return null;
-      }
-      return state.f(stream, state);
-    },
-
-    innerMode: function(state) {
-      if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
-      if (state.localState) return {state: state.localState, mode: state.localMode};
-      return {state: state, mode: mode};
-    },
-
-    blankLine: blankLine,
-
-    getType: getType,
-
-    fold: "markdown"
-  };
-  return mode;
-}, "xml");
-
-CodeMirror.defineMIME("text/x-markdown_math", "markdown_math");
-
-});

+ 70 - 73
views/main/index.html

@@ -30,84 +30,14 @@
 		window.$ = window.jQuery = require('jquery');
 		window.$ = window.jQuery = require('jquery');
         document.querySelector('html').classList.add(process.platform);
         document.querySelector('html').classList.add(process.platform);
         </script>
         </script>
-
-        <link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css">
-
         <link rel="stylesheet" href="moe-scrollbar.css">
         <link rel="stylesheet" href="moe-scrollbar.css">
-        <link rel="stylesheet" href="main/moe-popmenu.css">
-        <link rel="stylesheet" href="main/moe-treeview.css">
-
-        <script src="../node_modules/codemirror/lib/codemirror.js"></script>
-        <script src="../node_modules/codemirror/mode/markdown/markdown.js"></script>
-        <script src="../node_modules/codemirror/mode/gfm/gfm.js"></script>
-
-        <script src="../node_modules/codemirror/addon/mode/simple.js"></script>
-        <script src="../node_modules/codemirror/mode/xml/xml.js"></script>
-        <script src="../node_modules/codemirror/mode/css/css.js"></script>
-        <script src="../node_modules/codemirror/mode/clike/clike.js"></script>
-        <script src="../node_modules/codemirror/mode/haml/haml.js"></script>
-        <script src="../node_modules/codemirror/mode/htmlmixed/htmlmixed.js"></script>
-        <script src="../node_modules/codemirror/mode/javascript/javascript.js"></script>
-        <script src="../node_modules/codemirror/mode/jsx/jsx.js"></script>
-        <script src="../node_modules/codemirror/mode/php/php.js"></script>
-        <script src="../node_modules/codemirror/mode/python/python.js"></script>
-        <script src="../node_modules/codemirror/mode/powershell/powershell.js"></script>
-        <script src="../node_modules/codemirror/mode/ruby/ruby.js"></script>
-        <script src="../node_modules/codemirror/mode/shell/shell.js"></script>
-        <script src="../node_modules/codemirror/mode/slim/slim.js"></script>
-        <script src="../node_modules/codemirror/mode/sql/sql.js"></script>
-        <script src="../node_modules/codemirror/mode/stex/stex.js"></script>
-        <script src="../node_modules/codemirror/mode/textile/textile.js"></script>
-        <script src="../node_modules/codemirror/mode/verilog/verilog.js"></script>
-        <script src="../node_modules/codemirror/mode/xml/xml.js"></script>
-        <script src="../node_modules/codemirror/mode/xquery/xquery.js"></script>
-        <script src="../node_modules/codemirror/mode/rust/rust.js"></script>
-        <script src="../node_modules/codemirror/mode/mscgen/mscgen.js"></script>
-        <script src="../node_modules/codemirror/mode/dylan/dylan.js"></script>
-        <script src="../node_modules/codemirror/mode/meta.js"></script>
-
-        <script src="../node_modules/codemirror/addon/mode/overlay.js"></script>
-        <script src="../node_modules/codemirror/addon/mode/multiplex.js"></script>
-        <script src="../node_modules/codemirror/addon/scroll/simplescrollbars.js"></script>
-        <script src="../node_modules/codemirror/addon/selection/active-line.js"></script>
-        <script src="main/CodeMirror/continuelist.js"></script>
-        <script src="main/CodeMirror/markdown_math.js"></script>
-        <script src="main/CodeMirror/gfm_math.js"></script>
-        <link rel="stylesheet" href="../node_modules/codemirror/lib/codemirror.css">
-
-        <script src="../node_modules/katex/dist/katex.min.js"></script>
-        <link rel="stylesheet" href="../node_modules/katex/dist/katex.min.css">
-
-        <script src="../node_modules/biu.js/dist/biu.min.js"></script>
-        <link rel="stylesheet" href="../node_modules/biu.js/dist/biu.css">
-
-        <!-- Mathjax config -->
-        <script src="../node_modules/mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>
-        <script type="text/x-mathjax-config">
-            MathJax.Hub.Config({
-                tex2jax: {
-                    preview: "none",
-                    inlineMath: [ ['$','$'], ["\\(","\\)"] ],
-                    processEscapes: true
-                },
-                messageStyle: "none"
-            });
-        </script>
-
-        <script type="text/javascript" src="main/moe-document.js"></script>
-        <script type="text/javascript" src="main/moe-sidemenu.js"></script>
-        <!--script type="text/javascript" src="main/moe-treeview.js"></script-->
-        <script type="text/javascript" src="main/moe-popmenu.js"></script>
-        <script type="text/javascript" src="main/moe-mode.js"></script>
-        <script type="text/javascript" src="main/moe-export.js"></script>
-        <script type="text/javascript" src="main/moe-popmessage.js"></script>
-        <script type="text/javascript" src="main/moe-contextmenu.js"></script>
-
-        <script type="text/javascript" src="moe-localize.js"></script>
 
 
+        <link rel="stylesheet" href="main/moe-treeview.css">
         <link rel="stylesheet" href="fonts/moe-fonts.css">
         <link rel="stylesheet" href="fonts/moe-fonts.css">
         <link rel="stylesheet" href="main/moe-style.css">
         <link rel="stylesheet" href="main/moe-style.css">
         <link rel="stylesheet" href="main/base16-light.css">
         <link rel="stylesheet" href="main/base16-light.css">
+        <script type="text/javascript" src="main/moe-document.js"></script>
+
     </head>
     </head>
     <body>
     <body>
         <div id="electron-titlebar" class="inset" style="z-index: 1; ">
         <div id="electron-titlebar" class="inset" style="z-index: 1; ">
@@ -233,5 +163,72 @@
                 </ul>
                 </ul>
             </div>
             </div>
         </div>
         </div>
+
+        <link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css">
+        <link rel="stylesheet" href="main/moe-popmenu.css">
+        <link rel="stylesheet" href="../node_modules/codemirror/lib/codemirror.css">
+        <link rel="stylesheet" href="../node_modules/katex/dist/katex.min.css">
+        <link rel="stylesheet" href="../node_modules/biu.js/dist/biu.css">
+
+        <script src="../node_modules/codemirror/lib/codemirror.js"></script>
+        <script src="../node_modules/codemirror/addon/mode/simple.js"></script>
+        <script src="../node_modules/codemirror/mode/markdown/markdown.js"></script>
+        <script src="../node_modules/codemirror/mode/yaml/yaml.js"></script>
+        <script src="../node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js"></script>
+        <script src="../node_modules/codemirror/mode/gfm/gfm.js"></script>
+        <script src="../node_modules/codemirror/mode/xml/xml.js"></script>
+        <script src="../node_modules/codemirror/mode/css/css.js"></script>
+        <script src="../node_modules/codemirror/mode/htmlmixed/htmlmixed.js"></script>
+        <script src="../node_modules/codemirror/mode/javascript/javascript.js"></script>
+
+        <script src="../node_modules/codemirror/mode/clike/clike.js"></script>
+        <script src="../node_modules/codemirror/mode/haml/haml.js"></script>
+        <script src="../node_modules/codemirror/mode/jsx/jsx.js"></script>
+        <script src="../node_modules/codemirror/mode/php/php.js"></script>
+        <script src="../node_modules/codemirror/mode/python/python.js"></script>
+        <script src="../node_modules/codemirror/mode/powershell/powershell.js"></script>
+        <script src="../node_modules/codemirror/mode/ruby/ruby.js"></script>
+        <script src="../node_modules/codemirror/mode/shell/shell.js"></script>
+        <script src="../node_modules/codemirror/mode/slim/slim.js"></script>
+        <script src="../node_modules/codemirror/mode/sql/sql.js"></script>
+        <script src="../node_modules/codemirror/mode/stex/stex.js"></script>
+        <script src="../node_modules/codemirror/mode/textile/textile.js"></script>
+        <script src="../node_modules/codemirror/mode/verilog/verilog.js"></script>
+        <script src="../node_modules/codemirror/mode/xquery/xquery.js"></script>
+        <script src="../node_modules/codemirror/mode/rust/rust.js"></script>
+        <script src="../node_modules/codemirror/mode/mscgen/mscgen.js"></script>
+        <script src="../node_modules/codemirror/mode/dylan/dylan.js"></script>
+        <script src="../node_modules/codemirror/mode/meta.js"></script>
+
+        <script src="../node_modules/codemirror/addon/mode/overlay.js"></script>
+        <script src="../node_modules/codemirror/addon/mode/multiplex.js"></script>
+        <script src="../node_modules/codemirror/addon/scroll/simplescrollbars.js"></script>
+        <script src="../node_modules/codemirror/addon/selection/active-line.js"></script>
+        <script src="main/CodeMirror/continuelist.js"></script>
+
+        <script src="../node_modules/katex/dist/katex.min.js"></script>
+        <script src="../node_modules/biu.js/dist/biu.min.js"></script>
+        <!-- Mathjax config -->
+        <script src="../node_modules/mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>
+        <script type="text/x-mathjax-config">
+            MathJax.Hub.Config({
+                tex2jax: {
+                    preview: "none",
+                    inlineMath: [ ['$','$'], ["\\(","\\)"] ],
+                    processEscapes: true
+                },
+                messageStyle: "none"
+            });
+        </script>
+
+        <script type="text/javascript" src="main/moe-sidemenu.js"></script>
+        <script type="text/javascript" src="main/moe-treeview.js"></script>
+        <script type="text/javascript" src="main/moe-popmenu.js"></script>
+        <script type="text/javascript" src="main/moe-mode.js"></script>
+        <script type="text/javascript" src="main/moe-export.js"></script>
+        <script type="text/javascript" src="main/moe-popmessage.js"></script>
+        <script type="text/javascript" src="main/moe-contextmenu.js"></script>
+
+        <script type="text/javascript" src="moe-localize.js"></script>
     </body>
     </body>
 </html>
 </html>

+ 1 - 1
views/main/moe-document.js

@@ -45,7 +45,7 @@ $(() => {
 
 
     var editor = CodeMirror.fromTextArea(document.querySelector('#editor textarea'), {
     var editor = CodeMirror.fromTextArea(document.querySelector('#editor textarea'), {
         lineNumbers: false,
         lineNumbers: false,
-        mode: moeApp.config.get('math') ? 'gfm_math' : 'gfm',
+        mode: 'yaml-frontmatter',
         matchBrackets: true,
         matchBrackets: true,
         theme: moeApp.config.get('editor-theme'),
         theme: moeApp.config.get('editor-theme'),
         lineWrapping: true,
         lineWrapping: true,

+ 0 - 2
views/main/moe-settings.js

@@ -90,8 +90,6 @@ function setEditorLineHeight(val) {
 }
 }
 
 
 function setMath(val) {
 function setMath(val) {
-    if (val.toString() === 'true') window.editor.setOption('mode', 'gfm_math');
-    else window.editor.setOption('mode', 'gfm');
     window.editor.refresh();
     window.editor.refresh();
     window.updatePreview(true);
     window.updatePreview(true);
 }
 }

+ 79 - 1
views/main/moe-style.css

@@ -374,7 +374,7 @@ body[settings-editor-font="sans"] #editor  * {
     padding-bottom: 30px;
     padding-bottom: 30px;
     padding-left: 45px;
     padding-left: 45px;
     padding-right: 40px;
     padding-right: 40px;
-    font-size: 14 !important;
+    font-size: 14px !important;
     transition: all 500ms ease-in-out;
     transition: all 500ms ease-in-out;
     -webkit-user-select: initial;
     -webkit-user-select: initial;
 }
 }
@@ -483,6 +483,78 @@ moemark-linenumber{
     height: 100%;
     height: 100%;
 }
 }
 
 
+#renameForm input {
+    background-color: #fff;
+    border: 1px solid #ddd;
+    outline: none;
+    height: 30px;
+    width: 100%;
+    font-family: Roboto, Helvetica, 'Segoe UI', Arial, sans-serif;
+    color: #666;
+    box-sizing: border-box;
+    padding: 5px;
+}
+
+#renameForm input::-webkit-input-placeholder{
+    color: #ccc;
+}
+
+#renameForm input:hover,
+#renameForm input:active {
+    border: 1px solid #bbb;
+}
+
+#renameForm div.button{
+    display: flex;
+}
+#renameForm button {
+    background: #fff;
+    flex: 1;
+    border: 1px solid #ddd;
+    border-radius: 20px;
+    height: 30px;
+    margin: 25px 18px;
+    font-size: 22px;
+    line-height: 28px;
+    outline: none;
+}
+
+#renameForm .button-check{
+    color: #61b56a;
+}
+#renameForm .button-close{
+    color: #ff4a4a;
+}
+
+html.darwin #renameForm  input {
+    padding-left: 7px;
+    border-radius: 5px;
+}
+
+.renameForm {
+    position: fixed;
+    z-index: 1000;
+    width: 250px;
+    height: 80px;
+    transition: transform .3s ease;
+    font-size: 14px;
+    font-family: Roboto, Helvetica, 'Segoe UI', Arial, sans-serif;
+    padding: 30px;
+    background-color: #f7f7f7;
+    box-shadow: 0px 1px 11px -4px black;
+    border-radius: 13px;
+    left: 50%;
+    top: 100%;
+    opacity: 0;
+    transform: translateX(-50%) translateY(0%);
+}
+
+.renameForm.show{
+    top: 50%;
+    opacity: 1;
+    transform: translateX(-50%) translateY(-50%);
+}
+
 body[settings-mode=read] #drag-left, body[settings-mode=write] #drag-left {
 body[settings-mode=read] #drag-left, body[settings-mode=write] #drag-left {
     width: calc(100% - 6px);
     width: calc(100% - 6px);
 }
 }
@@ -588,4 +660,10 @@ body[settings-mode=read] #drag-right, body[settings-mode=write] #drag-right {
 
 
 div#cover-bottom {
 div#cover-bottom {
     line-height: 1 !important;
     line-height: 1 !important;
+}
+
+#editor.ctrl span.cm-string.cm-url:hover {
+    text-decoration: underline;
+    color: blue;
+    cursor: pointer;
 }
 }