mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
fix bugs
This commit is contained in:
parent
827300b1ed
commit
c20a0fdc1a
File diff suppressed because one or more lines are too long
@ -15875,7 +15875,7 @@ var Action = function () {
|
|||||||
|
|
||||||
// Hide side by side if needed
|
// Hide side by side if needed
|
||||||
var sidebyside = cm.getWrapperElement().nextSibling;
|
var sidebyside = cm.getWrapperElement().nextSibling;
|
||||||
if (/editor-preview-active-side/.test(sidebyside.className)) this.toggleSideBySide(editor);
|
if (/editor-preview-active-side/.test(sidebyside.className)) Action.toggleSideBySide(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15899,7 +15899,7 @@ var Action = function () {
|
|||||||
// give some time for the transition from editor.css to fire and the view to slide from right to left,
|
// give some time for the transition from editor.css to fire and the view to slide from right to left,
|
||||||
// instead of just appearing.
|
// instead of just appearing.
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (!cm.getOption("fullScreen")) this.toggleFullScreen(editor);
|
if (!cm.getOption("fullScreen")) Action.toggleFullScreen(editor);
|
||||||
preview.className += " editor-preview-active-side";
|
preview.className += " editor-preview-active-side";
|
||||||
}, 1);
|
}, 1);
|
||||||
toolbarButton.className += " active";
|
toolbarButton.className += " active";
|
||||||
@ -15975,7 +15975,7 @@ var Action = function () {
|
|||||||
|
|
||||||
// Turn off side by side if needed
|
// Turn off side by side if needed
|
||||||
var sidebyside = cm.getWrapperElement().nextSibling;
|
var sidebyside = cm.getWrapperElement().nextSibling;
|
||||||
if (/editor-preview-active-side/.test(sidebyside.className)) this.toggleSideBySide(editor);
|
if (/editor-preview-active-side/.test(sidebyside.className)) Action.toggleSideBySide(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16425,6 +16425,30 @@ CodeMirror.commands.shiftTabAndUnindentMarkdownList = function (cm) {
|
|||||||
},{"codemirror":10}],22:[function(require,module,exports){
|
},{"codemirror":10}],22:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /**
|
||||||
|
* Created by WittBulter on 2017/1/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var _simplemde = require("./simplemde");
|
||||||
|
|
||||||
|
var _simplemde2 = _interopRequireDefault(_simplemde);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object") return module.exports = _simplemde2.default;
|
||||||
|
|
||||||
|
if (typeof define === "function" && define.amd) define('SimpleMDE', [], function () {
|
||||||
|
return _simplemde2.default;
|
||||||
|
});
|
||||||
|
|
||||||
|
window.SimpleMDE = _simplemde2.default;
|
||||||
|
})();
|
||||||
|
|
||||||
|
},{"./simplemde":24}],23:[function(require,module,exports){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
value: true
|
value: true
|
||||||
});
|
});
|
||||||
@ -16671,13 +16695,12 @@ var promptTexts = exports.promptTexts = {
|
|||||||
image: "URL of the image:"
|
image: "URL of the image:"
|
||||||
};
|
};
|
||||||
|
|
||||||
},{"./action":19}],23:[function(require,module,exports){
|
},{"./action":19}],24:[function(require,module,exports){
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
value: true
|
value: true
|
||||||
});
|
});
|
||||||
exports.SimpleMDE = undefined;
|
|
||||||
|
|
||||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||||
|
|
||||||
@ -16786,7 +16809,7 @@ var createTootlip = function createTootlip(title, action, shortcuts) {
|
|||||||
* Interface of SimpleMDE.
|
* Interface of SimpleMDE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var SimpleMDE = exports.SimpleMDE = function (_Action) {
|
var SimpleMDE = function (_Action) {
|
||||||
_inherits(SimpleMDE, _Action);
|
_inherits(SimpleMDE, _Action);
|
||||||
|
|
||||||
function SimpleMDE() {
|
function SimpleMDE() {
|
||||||
@ -16839,35 +16862,14 @@ var SimpleMDE = exports.SimpleMDE = function (_Action) {
|
|||||||
options.toolbar = [];
|
options.toolbar = [];
|
||||||
|
|
||||||
// Loop over the built in buttons, to get the preferred order
|
// Loop over the built in buttons, to get the preferred order
|
||||||
var _iteratorNormalCompletion = true;
|
for (var key in _metadata.toolbarBuiltInButtons) {
|
||||||
var _didIteratorError = false;
|
if (_metadata.toolbarBuiltInButtons.hasOwnProperty(key)) {
|
||||||
var _iteratorError = undefined;
|
if (key.indexOf("separator-") != -1) {
|
||||||
|
options.toolbar.push("|");
|
||||||
try {
|
|
||||||
for (var _iterator = _metadata.toolbarBuiltInButtons[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
||||||
var key = _step.value;
|
|
||||||
|
|
||||||
if (_metadata.toolbarBuiltInButtons.hasOwnProperty(key)) {
|
|
||||||
if (key.indexOf("separator-") != -1) {
|
|
||||||
options.toolbar.push("|");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_metadata.toolbarBuiltInButtons[key].default === true || options.showIcons && options.showIcons.constructor === Array && options.showIcons.indexOf(key) != -1) {
|
|
||||||
options.toolbar.push(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (err) {
|
if (_metadata.toolbarBuiltInButtons[key].default === true || options.showIcons && options.showIcons.constructor === Array && options.showIcons.indexOf(key) != -1) {
|
||||||
_didIteratorError = true;
|
options.toolbar.push(key);
|
||||||
_iteratorError = err;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
||||||
_iterator.return();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (_didIteratorError) {
|
|
||||||
throw _iteratorError;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16973,35 +16975,14 @@ var SimpleMDE = exports.SimpleMDE = function (_Action) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var keyMaps = {};
|
var keyMaps = {};
|
||||||
|
|
||||||
var _iteratorNormalCompletion2 = true;
|
for (var key in options.shortcuts) {
|
||||||
var _didIteratorError2 = false;
|
// null stands for "do not bind this command"
|
||||||
var _iteratorError2 = undefined;
|
if (options.shortcuts[key] !== null && _metadata.bindings[key] !== null) {
|
||||||
|
(function (key) {
|
||||||
try {
|
keyMaps[_utils2.default.fixShortcut(options.shortcuts[key])] = function () {
|
||||||
for (var _iterator2 = options.shortcuts[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
_metadata.bindings[key](self);
|
||||||
var key = _step2.value;
|
};
|
||||||
|
})(key);
|
||||||
// null stands for "do not bind this command"
|
|
||||||
if (options.shortcuts[key] !== null && _metadata.bindings[key] !== null) {
|
|
||||||
(function (key) {
|
|
||||||
keyMaps[_utils2.default.fixShortcut(options.shortcuts[key])] = function () {
|
|
||||||
_metadata.bindings[key](self);
|
|
||||||
};
|
|
||||||
})(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
_didIteratorError2 = true;
|
|
||||||
_iteratorError2 = err;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
||||||
_iterator2.return();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (_didIteratorError2) {
|
|
||||||
throw _iteratorError2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17279,36 +17260,15 @@ var SimpleMDE = exports.SimpleMDE = function (_Action) {
|
|||||||
cm.on("cursorActivity", function () {
|
cm.on("cursorActivity", function () {
|
||||||
var stat = _base2.default.getState(cm);
|
var stat = _base2.default.getState(cm);
|
||||||
|
|
||||||
var _iteratorNormalCompletion3 = true;
|
for (var key in toolbarData) {
|
||||||
var _didIteratorError3 = false;
|
(function (key) {
|
||||||
var _iteratorError3 = undefined;
|
var el = toolbarData[key];
|
||||||
|
if (stat[key]) {
|
||||||
try {
|
el.className += " active";
|
||||||
for (var _iterator3 = toolbarData[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
} else if (key != "fullscreen" && key != "side-by-side") {
|
||||||
var key = _step3.value;
|
el.className = el.className.replace(/\s*active\s*/g, "");
|
||||||
|
|
||||||
(function (key) {
|
|
||||||
var el = toolbarData[key];
|
|
||||||
if (stat[key]) {
|
|
||||||
el.className += " active";
|
|
||||||
} else if (key != "fullscreen" && key != "side-by-side") {
|
|
||||||
el.className = el.className.replace(/\s*active\s*/g, "");
|
|
||||||
}
|
|
||||||
})(key);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
_didIteratorError3 = true;
|
|
||||||
_iteratorError3 = err;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
||||||
_iterator3.return();
|
|
||||||
}
|
}
|
||||||
} finally {
|
})(key);
|
||||||
if (_didIteratorError3) {
|
|
||||||
throw _iteratorError3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -17618,7 +17578,9 @@ var SimpleMDE = exports.SimpleMDE = function (_Action) {
|
|||||||
return SimpleMDE;
|
return SimpleMDE;
|
||||||
}(_action2.default);
|
}(_action2.default);
|
||||||
|
|
||||||
},{"./action":19,"./base":20,"./codemirror/tablist":21,"./metadata":22,"./utils":24,"codemirror":10,"codemirror-spell-checker":4,"codemirror/addon/display/fullscreen":5,"codemirror/addon/display/placeholder":6,"codemirror/addon/edit/continuelist":7,"codemirror/addon/mode/overlay":8,"codemirror/addon/selection/mark-selection":9,"codemirror/mode/gfm/gfm":11,"codemirror/mode/markdown/markdown":12,"codemirror/mode/xml/xml":14,"marked":17}],24:[function(require,module,exports){
|
exports.default = SimpleMDE;
|
||||||
|
|
||||||
|
},{"./action":19,"./base":20,"./codemirror/tablist":21,"./metadata":23,"./utils":25,"codemirror":10,"codemirror-spell-checker":4,"codemirror/addon/display/fullscreen":5,"codemirror/addon/display/placeholder":6,"codemirror/addon/edit/continuelist":7,"codemirror/addon/mode/overlay":8,"codemirror/addon/selection/mark-selection":9,"codemirror/mode/gfm/gfm":11,"codemirror/mode/markdown/markdown":12,"codemirror/mode/xml/xml":14,"marked":17}],25:[function(require,module,exports){
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
@ -17677,33 +17639,11 @@ exports.default = new (function () {
|
|||||||
}, {
|
}, {
|
||||||
key: 'getBindingName',
|
key: 'getBindingName',
|
||||||
value: function getBindingName(f) {
|
value: function getBindingName(f) {
|
||||||
var _iteratorNormalCompletion = true;
|
for (var key in _metadata.bindings) {
|
||||||
var _didIteratorError = false;
|
if (_metadata.bindings[key] === f) {
|
||||||
var _iteratorError = undefined;
|
return key;
|
||||||
|
|
||||||
try {
|
|
||||||
for (var _iterator = _metadata.bindings[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
||||||
var key = _step.value;
|
|
||||||
|
|
||||||
if (_metadata.bindings[key] === f) {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
_didIteratorError = true;
|
|
||||||
_iteratorError = err;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
||||||
_iterator.return();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (_didIteratorError) {
|
|
||||||
throw _iteratorError;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -17741,5 +17681,5 @@ exports.default = new (function () {
|
|||||||
return Utils;
|
return Utils;
|
||||||
}())();
|
}())();
|
||||||
|
|
||||||
},{"./metadata":22}]},{},[23])(23)
|
},{"./metadata":23}]},{},[22])(22)
|
||||||
});
|
});
|
4
dist/simplemde.min.js
vendored
4
dist/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
@ -48,7 +48,7 @@ gulp.task("lint", ["prettify-js"], () =>{
|
|||||||
});
|
});
|
||||||
|
|
||||||
function taskBrowserify(opts) {
|
function taskBrowserify(opts) {
|
||||||
return browserify("./src/js/simplemde.js", opts)
|
return browserify("./src/js/index.js", opts)
|
||||||
.transform("babelify", {presets: ['es2015', 'stage-3']})
|
.transform("babelify", {presets: ['es2015', 'stage-3']})
|
||||||
.bundle();
|
.bundle();
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ export default class Action {
|
|||||||
// Hide side by side if needed
|
// Hide side by side if needed
|
||||||
const sidebyside = cm.getWrapperElement().nextSibling;
|
const sidebyside = cm.getWrapperElement().nextSibling;
|
||||||
if (/editor-preview-active-side/.test(sidebyside.className))
|
if (/editor-preview-active-side/.test(sidebyside.className))
|
||||||
this.toggleSideBySide(editor);
|
Action.toggleSideBySide(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ export default class Action {
|
|||||||
// instead of just appearing.
|
// instead of just appearing.
|
||||||
setTimeout(function (){
|
setTimeout(function (){
|
||||||
if (!cm.getOption("fullScreen"))
|
if (!cm.getOption("fullScreen"))
|
||||||
this.toggleFullScreen(editor);
|
Action.toggleFullScreen(editor);
|
||||||
preview.className += " editor-preview-active-side";
|
preview.className += " editor-preview-active-side";
|
||||||
}, 1);
|
}, 1);
|
||||||
toolbarButton.className += " active";
|
toolbarButton.className += " active";
|
||||||
@ -527,7 +527,7 @@ export default class Action {
|
|||||||
// Turn off side by side if needed
|
// Turn off side by side if needed
|
||||||
const sidebyside = cm.getWrapperElement().nextSibling;
|
const sidebyside = cm.getWrapperElement().nextSibling;
|
||||||
if (/editor-preview-active-side/.test(sidebyside.className))
|
if (/editor-preview-active-side/.test(sidebyside.className))
|
||||||
this.toggleSideBySide(editor);
|
Action.toggleSideBySide(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
13
src/js/index.js
Normal file
13
src/js/index.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Created by WittBulter on 2017/1/17.
|
||||||
|
*/
|
||||||
|
import SimpleMDE from './simplemde'
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
if (typeof module === "object") return module.exports = SimpleMDE;
|
||||||
|
|
||||||
|
if (typeof define === "function" && define.amd ) define('SimpleMDE',[], () => SimpleMDE);
|
||||||
|
|
||||||
|
window.SimpleMDE = SimpleMDE;
|
||||||
|
})()
|
||||||
|
|
@ -71,13 +71,12 @@ const createTootlip = (title, action, shortcuts) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export class SimpleMDE extends Action {
|
class SimpleMDE extends Action {
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
super()
|
super()
|
||||||
// Used later to refer to it"s parent
|
// Used later to refer to it"s parent
|
||||||
options.parent = this;
|
options.parent = this;
|
||||||
|
|
||||||
|
|
||||||
// Check if Font Awesome needs to be auto downloaded
|
// Check if Font Awesome needs to be auto downloaded
|
||||||
let autoDownloadFA = true;
|
let autoDownloadFA = true;
|
||||||
|
|
||||||
@ -122,7 +121,7 @@ export class SimpleMDE extends Action {
|
|||||||
|
|
||||||
|
|
||||||
// Loop over the built in buttons, to get the preferred order
|
// Loop over the built in buttons, to get the preferred order
|
||||||
for(let key of toolbarBuiltInButtons) {
|
for(let key in toolbarBuiltInButtons) {
|
||||||
if(toolbarBuiltInButtons.hasOwnProperty(key)) {
|
if(toolbarBuiltInButtons.hasOwnProperty(key)) {
|
||||||
if(key.indexOf("separator-") != -1) {
|
if(key.indexOf("separator-") != -1) {
|
||||||
options.toolbar.push("|");
|
options.toolbar.push("|");
|
||||||
@ -236,7 +235,7 @@ export class SimpleMDE extends Action {
|
|||||||
const self = this;
|
const self = this;
|
||||||
let keyMaps = {};
|
let keyMaps = {};
|
||||||
|
|
||||||
for(let key of options.shortcuts) {
|
for(let key in options.shortcuts) {
|
||||||
// null stands for "do not bind this command"
|
// null stands for "do not bind this command"
|
||||||
if(options.shortcuts[key] !== null && bindings[key] !== null) {
|
if(options.shortcuts[key] !== null && bindings[key] !== null) {
|
||||||
(function(key) {
|
(function(key) {
|
||||||
@ -514,7 +513,7 @@ export class SimpleMDE extends Action {
|
|||||||
cm.on("cursorActivity", function() {
|
cm.on("cursorActivity", function() {
|
||||||
let stat = base.getState(cm);
|
let stat = base.getState(cm);
|
||||||
|
|
||||||
for(let key of toolbarData) {
|
for(let key in toolbarData) {
|
||||||
(function(key) {
|
(function(key) {
|
||||||
let el = toolbarData[key];
|
let el = toolbarData[key];
|
||||||
if(stat[key]) {
|
if(stat[key]) {
|
||||||
@ -782,6 +781,5 @@ export class SimpleMDE extends Action {
|
|||||||
this.clearAutosavedValue();
|
this.clearAutosavedValue();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
export default SimpleMDE
|
||||||
}
|
|
@ -35,7 +35,7 @@ export default new class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBindingName (f){
|
getBindingName (f){
|
||||||
for(let key of bindings) {
|
for(let key in bindings) {
|
||||||
if(bindings[key] === f) {
|
if(bindings[key] === f) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user