avoid negative conditionals

pull/510/head
WittBulter 7 years ago
parent 2e43015094
commit 6a932ef300

File diff suppressed because one or more lines are too long

@ -15872,7 +15872,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)) Action.toggleSideBySide(editor); if (/editor-preview-active-side/.test(sidebyside.className)) this.toggleSideBySide(editor);
} }
/** /**
@ -15882,6 +15882,8 @@ var Action = function () {
}, { }, {
key: 'toggleSideBySide', key: 'toggleSideBySide',
value: function toggleSideBySide(editor) { value: function toggleSideBySide(editor) {
var _this = this;
var cm = editor.codemirror; var cm = editor.codemirror;
var wrapper = cm.getWrapperElement(); var wrapper = cm.getWrapperElement();
var preview = wrapper.nextSibling; var preview = wrapper.nextSibling;
@ -15896,7 +15898,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")) Action.toggleFullScreen(editor); if (!cm.getOption("fullScreen")) _this.toggleFullScreen(editor);
preview.className += " editor-preview-active-side"; preview.className += " editor-preview-active-side";
}, 1); }, 1);
toolbarButton.className += " active"; toolbarButton.className += " active";
@ -15974,7 +15976,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)) Action.toggleSideBySide(editor); if (/editor-preview-active-side/.test(sidebyside.className)) this.toggleSideBySide(editor);
} }
/** /**
@ -16070,6 +16072,11 @@ var Action = function () {
cm.redo(); cm.redo();
cm.focus(); cm.focus();
} }
}, {
key: 'openGuide',
value: function openGuide() {
window.open('https://simplemde.com/markdown-guide');
}
}]); }]);
return Action; return Action;
@ -16643,7 +16650,7 @@ var toolbarBuiltInButtons = exports.toolbarBuiltInButtons = {
}, },
"guide": { "guide": {
name: "guide", name: "guide",
action: "https://simplemde.com/markdown-guide", action: "openGuide",
className: "fa fa-question-circle", className: "fa fa-question-circle",
title: "Markdown Guide", title: "Markdown Guide",
default: true default: true
@ -17168,12 +17175,6 @@ var SimpleMDE = function (_Action) {
isCustomMethods ? v.action(_this3) : _get(SimpleMDE.prototype.__proto__ || Object.getPrototypeOf(SimpleMDE.prototype), v.action, _this3).call(_this3, _this3); isCustomMethods ? v.action(_this3) : _get(SimpleMDE.prototype.__proto__ || Object.getPrototypeOf(SimpleMDE.prototype), v.action, _this3).call(_this3, _this3);
}; };
} }
// Link can be converted to a function
// todo
// if(typeof v.action === "string") {
// el.href = v.action;
// el.target = "_blank";
// }
toolbarData[v.name || v] = el; toolbarData[v.name || v] = el;
bar.appendChild(el); bar.appendChild(el);
@ -17181,7 +17182,6 @@ var SimpleMDE = function (_Action) {
this.toolbarElements = toolbarData; this.toolbarElements = toolbarData;
this.codemirror.on("cursorActivity", function () { this.codemirror.on("cursorActivity", function () {
var stat = _base2.default.getState(_this3.codemirror); var stat = _base2.default.getState(_this3.codemirror);
console.log(toolbarData, 1);
for (var key in toolbarData) { for (var key in toolbarData) {
var el = toolbarData[key]; var el = toolbarData[key];
if (stat[key]) { if (stat[key]) {

File diff suppressed because one or more lines are too long

@ -417,7 +417,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))
Action.toggleSideBySide(editor); this.toggleSideBySide(editor);
} }
@ -442,7 +442,7 @@ export default class Action {
// instead of just appearing. // instead of just appearing.
setTimeout(() =>{ setTimeout(() =>{
if (!cm.getOption("fullScreen")) if (!cm.getOption("fullScreen"))
Action.toggleFullScreen(editor); this.toggleFullScreen(editor);
preview.className += " editor-preview-active-side"; preview.className += " editor-preview-active-side";
}, 1); }, 1);
toolbarButton.className += " active"; toolbarButton.className += " active";
@ -520,7 +520,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))
Action.toggleSideBySide(editor); this.toggleSideBySide(editor);
} }
/** /**
@ -594,5 +594,9 @@ export default class Action {
cm.focus(); cm.focus();
} }
openGuide (){
window.open('https://simplemde.com/markdown-guide')
}
} }

@ -197,7 +197,7 @@ export const toolbarBuiltInButtons = {
}, },
"guide": { "guide": {
name: "guide", name: "guide",
action: "https://simplemde.com/markdown-guide", action: "openGuide",
className: "fa fa-question-circle", className: "fa fa-question-circle",
title: "Markdown Guide", title: "Markdown Guide",
default: true default: true

@ -391,12 +391,6 @@ class SimpleMDE extends Action {
isCustomMethods ? v.action(this) : super[v.action](this) isCustomMethods ? v.action(this) : super[v.action](this)
}; };
} }
// Link can be converted to a function
// todo
// if(typeof v.action === "string") {
// el.href = v.action;
// el.target = "_blank";
// }
toolbarData[v.name || v] = el; toolbarData[v.name || v] = el;
bar.appendChild(el); bar.appendChild(el);

Loading…
Cancel
Save