|
|
@ -646,11 +646,6 @@ define([
|
|
|
|
}).filter(Boolean);
|
|
|
|
}).filter(Boolean);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var checkMt = function (framework) {
|
|
|
|
|
|
|
|
var cm = $('.CodeMirror').length;
|
|
|
|
|
|
|
|
if (!cm) { framework.setMediaTagEmbedder(); }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var STATIC_TYPES = {
|
|
|
|
var STATIC_TYPES = {
|
|
|
|
md: {
|
|
|
|
md: {
|
|
|
|
defaultOpts: {
|
|
|
|
defaultOpts: {
|
|
|
@ -666,7 +661,7 @@ define([
|
|
|
|
var cursorGetter;
|
|
|
|
var cursorGetter;
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
tag: tag,
|
|
|
|
tag: tag,
|
|
|
|
edit: function (cb, tmp, framework) {
|
|
|
|
edit: function (cb, tmp) {
|
|
|
|
var t = h('textarea');
|
|
|
|
var t = h('textarea');
|
|
|
|
var block = h('div.cp-form-edit-options-block', [t]);
|
|
|
|
var block = h('div.cp-form-edit-options-block', [t]);
|
|
|
|
var cm = SFCodeMirror.create("gfm", CMeditor, t);
|
|
|
|
var cm = SFCodeMirror.create("gfm", CMeditor, t);
|
|
|
@ -676,14 +671,6 @@ define([
|
|
|
|
editor.setOption('styleActiveLine', true);
|
|
|
|
editor.setOption('styleActiveLine', true);
|
|
|
|
editor.setOption('readOnly', false);
|
|
|
|
editor.setOption('readOnly', false);
|
|
|
|
|
|
|
|
|
|
|
|
editor.on('focus', function () {
|
|
|
|
|
|
|
|
framework.setMediaTagEmbedder();
|
|
|
|
|
|
|
|
framework.setMediaTagEmbedder(function (mt) {
|
|
|
|
|
|
|
|
editor.focus();
|
|
|
|
|
|
|
|
editor.replaceSelection($(mt)[0].outerHTML);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var text = opts.text;
|
|
|
|
var text = opts.text;
|
|
|
|
var cursor;
|
|
|
|
var cursor;
|
|
|
|
if (tmp && tmp.content && tmp.old.text === text) {
|
|
|
|
if (tmp && tmp.content && tmp.old.text === text) {
|
|
|
@ -705,7 +692,12 @@ define([
|
|
|
|
editor.focus();
|
|
|
|
editor.focus();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (APP.common) {
|
|
|
|
if (APP.common) {
|
|
|
|
var markdownTb = APP.common.createMarkdownToolbar(editor);
|
|
|
|
var markdownTb = APP.common.createMarkdownToolbar(editor, {
|
|
|
|
|
|
|
|
embed: function (mt) {
|
|
|
|
|
|
|
|
editor.focus();
|
|
|
|
|
|
|
|
editor.replaceSelection($(mt)[0].outerHTML);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
$(block).prepend(markdownTb.toolbar);
|
|
|
|
$(block).prepend(markdownTb.toolbar);
|
|
|
|
$(markdownTb.toolbar).show();
|
|
|
|
$(markdownTb.toolbar).show();
|
|
|
|
cm.configureTheme(APP.common, function () {});
|
|
|
|
cm.configureTheme(APP.common, function () {});
|
|
|
@ -714,7 +706,6 @@ define([
|
|
|
|
var cancelBlock = h('button.btn.btn-secondary', Messages.cancel);
|
|
|
|
var cancelBlock = h('button.btn.btn-secondary', Messages.cancel);
|
|
|
|
$(cancelBlock).click(function () {
|
|
|
|
$(cancelBlock).click(function () {
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
checkMt(framework);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// Save changes
|
|
|
|
// Save changes
|
|
|
|
var saveBlock = h('button.btn.btn-primary', [
|
|
|
|
var saveBlock = h('button.btn.btn-primary', [
|
|
|
@ -730,7 +721,6 @@ define([
|
|
|
|
$(saveBlock).click(function () {
|
|
|
|
$(saveBlock).click(function () {
|
|
|
|
$(saveBlock).attr('disabled', 'disabled');
|
|
|
|
$(saveBlock).attr('disabled', 'disabled');
|
|
|
|
cb(getContent());
|
|
|
|
cb(getContent());
|
|
|
|
checkMt(framework);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cursorGetter = function () {
|
|
|
|
cursorGetter = function () {
|
|
|
@ -1698,7 +1688,6 @@ define([
|
|
|
|
$('.cp-form-block[data-id="'+uid+'"]').remove();
|
|
|
|
$('.cp-form-block[data-id="'+uid+'"]').remove();
|
|
|
|
framework.localChange();
|
|
|
|
framework.localChange();
|
|
|
|
updateAddInline();
|
|
|
|
updateAddInline();
|
|
|
|
checkMt(framework);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Values
|
|
|
|
// Values
|
|
|
|