diff --git a/src/components/Tinymce/src/Editor.vue b/src/components/Tinymce/src/Editor.vue index d2303e2d7..f9d0e718e 100644 --- a/src/components/Tinymce/src/Editor.vue +++ b/src/components/Tinymce/src/Editor.vue @@ -23,7 +23,7 @@ import { useScript } from '/@/hooks/web/useScript'; import { snowUuid } from '/@/utils/uuid'; import { bindHandlers } from './helper'; - import LineHeight from './lineHeight'; + // import lineHeight from './lineHeight'; const CDN_URL = 'https://cdn.bootcdn.net/ajax/libs/tinymce/5.5.1'; @@ -71,7 +71,7 @@ advlist_number_styles: 'default', object_resizing: false, fontsize_formats: '10px 11px 12px 14px 16px 18px 20px 24px 36px 48px', - lineheight_formats: "1 1.5 1.75 2.0 3.0 4.0 5.0", + lineheight_formats: '1 1.5 1.75 2.0 3.0 4.0 5.0', ...options, setup: (editor: any) => { editorRef.value = editor; @@ -120,7 +120,7 @@ } function initEditor() { - getTinymce().PluginManager.add('lineHeight', LineHeight(getTinymce())); + // getTinymce().PluginManager.add('lineHeight', lineHeight(getTinymce())); getTinymce().init(unref(initOptions)); } diff --git a/src/components/Tinymce/src/lineHeight.js b/src/components/Tinymce/src/lineHeight.js deleted file mode 100644 index 1d8104f7b..000000000 --- a/src/components/Tinymce/src/lineHeight.js +++ /dev/null @@ -1,44 +0,0 @@ -const LineHeight = function (e) { - e.PluginManager.add('lineheight', function (t, n, r) { - t.on('init', function () { - t.formatter.register({ - lineheight: { - inline: 'span', - styles: { - 'line-height': '%value', - }, - }, - }); - }); - t.ui.registry.addMenuButton('lineheight', { - icon: 'lineheight', - tooltip: '设置行高', - fetch: function (callback) { - var dom = t.dom; - var blocks = t.selection.getSelectedBlocks(); - var lhv = 0; - global$1.each(blocks, function (block) { - if (lhv == 0) { - lhv = dom.getStyle(block, 'line-height') ? dom.getStyle(block, 'line-height') : 0; - } - }); - var items = lineheight_val.split(' ').map(function (item) { - var text = item; - var value = item; - return { - type: 'togglemenuitem', - text: text, - active: lhv == value ? true : false, - onAction: function () { - doAct(value); - }, - }; - }); - callback(items); - }, - }); - }); - e.PluginManager.requireLangPack('lineheight', 'de'); -}; - -export default LineHeight; diff --git a/src/components/Tinymce/src/lineHeight.ts b/src/components/Tinymce/src/lineHeight.ts new file mode 100644 index 000000000..6d7c25035 --- /dev/null +++ b/src/components/Tinymce/src/lineHeight.ts @@ -0,0 +1,45 @@ +const lineHeight = function (tinymce: any) { + tinymce.PluginManager.add('lineheight', function (t: any) { + t.on('init', function () { + t.formatter.register({ + lineheight: { + inline: 'span', + styles: { + 'line-height': '%value', + }, + }, + }); + }); + + t.ui.registry.addMenuButton('lineheight', { + icon: 'lineheight', + tooltip: '设置行高', + // fetch: function (callback: Fn) { + // var dom = t.dom; + // var blocks = t.selection.getSelectedBlocks(); + // var lhv = 0; + // global$1.each(blocks, function (block: any) { + // if (lhv == 0) { + // lhv = dom.getStyle(block, 'line-height') ? dom.getStyle(block, 'line-height') : 0; + // } + // }); + // var items = lineheight_val.split(' ').map(function (item) { + // var text = item; + // var value = item; + // return { + // type: 'togglemenuitem', + // text: text, + // active: lhv == value ? true : false, + // onAction: function () { + // doAct(value); + // }, + // }; + // }); + // callback(items); + // }, + }); + }); + tinymce.PluginManager.requireLangPack('lineheight', 'de'); +}; + +export default lineHeight; diff --git a/src/components/Tinymce/src/plugins.ts b/src/components/Tinymce/src/plugins.ts index d21f7f7b1..59602d160 100644 --- a/src/components/Tinymce/src/plugins.ts +++ b/src/components/Tinymce/src/plugins.ts @@ -4,7 +4,7 @@ // colorpicker/contextmenu/textcolor plugin is now built in to the core editor, please remove it from your editor configuration const plugins = [ - 'advlist anchor autolink autosave code codesample directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textpattern visualblocks visualchars wordcount', + 'lineheight advlist anchor autolink autosave code codesample directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textpattern visualblocks visualchars wordcount', ]; export default plugins;