Commit 8a98225c8e9f6c08a704617fb095b2f45f180cd0

Authored by vben
1 parent 2be166d6

chore(tinymec): remove lineHeight

src/components/Tinymce/src/Editor.vue
... ... @@ -23,7 +23,7 @@
23 23 import { useScript } from '/@/hooks/web/useScript';
24 24 import { snowUuid } from '/@/utils/uuid';
25 25 import { bindHandlers } from './helper';
26   - import LineHeight from './lineHeight';
  26 + // import lineHeight from './lineHeight';
27 27  
28 28 const CDN_URL = 'https://cdn.bootcdn.net/ajax/libs/tinymce/5.5.1';
29 29  
... ... @@ -71,7 +71,7 @@
71 71 advlist_number_styles: 'default',
72 72 object_resizing: false,
73 73 fontsize_formats: '10px 11px 12px 14px 16px 18px 20px 24px 36px 48px',
74   - lineheight_formats: "1 1.5 1.75 2.0 3.0 4.0 5.0",
  74 + lineheight_formats: '1 1.5 1.75 2.0 3.0 4.0 5.0',
75 75 ...options,
76 76 setup: (editor: any) => {
77 77 editorRef.value = editor;
... ... @@ -120,7 +120,7 @@
120 120 }
121 121  
122 122 function initEditor() {
123   - getTinymce().PluginManager.add('lineHeight', LineHeight(getTinymce()));
  123 + // getTinymce().PluginManager.add('lineHeight', lineHeight(getTinymce()));
124 124 getTinymce().init(unref(initOptions));
125 125 }
126 126  
... ...
src/components/Tinymce/src/lineHeight.js deleted 100644 → 0
1   -const LineHeight = function (e) {
2   - e.PluginManager.add('lineheight', function (t, n, r) {
3   - t.on('init', function () {
4   - t.formatter.register({
5   - lineheight: {
6   - inline: 'span',
7   - styles: {
8   - 'line-height': '%value',
9   - },
10   - },
11   - });
12   - });
13   - t.ui.registry.addMenuButton('lineheight', {
14   - icon: 'lineheight',
15   - tooltip: '设置行高',
16   - fetch: function (callback) {
17   - var dom = t.dom;
18   - var blocks = t.selection.getSelectedBlocks();
19   - var lhv = 0;
20   - global$1.each(blocks, function (block) {
21   - if (lhv == 0) {
22   - lhv = dom.getStyle(block, 'line-height') ? dom.getStyle(block, 'line-height') : 0;
23   - }
24   - });
25   - var items = lineheight_val.split(' ').map(function (item) {
26   - var text = item;
27   - var value = item;
28   - return {
29   - type: 'togglemenuitem',
30   - text: text,
31   - active: lhv == value ? true : false,
32   - onAction: function () {
33   - doAct(value);
34   - },
35   - };
36   - });
37   - callback(items);
38   - },
39   - });
40   - });
41   - e.PluginManager.requireLangPack('lineheight', 'de');
42   -};
43   -
44   -export default LineHeight;
src/components/Tinymce/src/lineHeight.ts 0 → 100644
  1 +const lineHeight = function (tinymce: any) {
  2 + tinymce.PluginManager.add('lineheight', function (t: any) {
  3 + t.on('init', function () {
  4 + t.formatter.register({
  5 + lineheight: {
  6 + inline: 'span',
  7 + styles: {
  8 + 'line-height': '%value',
  9 + },
  10 + },
  11 + });
  12 + });
  13 +
  14 + t.ui.registry.addMenuButton('lineheight', {
  15 + icon: 'lineheight',
  16 + tooltip: '设置行高',
  17 + // fetch: function (callback: Fn) {
  18 + // var dom = t.dom;
  19 + // var blocks = t.selection.getSelectedBlocks();
  20 + // var lhv = 0;
  21 + // global$1.each(blocks, function (block: any) {
  22 + // if (lhv == 0) {
  23 + // lhv = dom.getStyle(block, 'line-height') ? dom.getStyle(block, 'line-height') : 0;
  24 + // }
  25 + // });
  26 + // var items = lineheight_val.split(' ').map(function (item) {
  27 + // var text = item;
  28 + // var value = item;
  29 + // return {
  30 + // type: 'togglemenuitem',
  31 + // text: text,
  32 + // active: lhv == value ? true : false,
  33 + // onAction: function () {
  34 + // doAct(value);
  35 + // },
  36 + // };
  37 + // });
  38 + // callback(items);
  39 + // },
  40 + });
  41 + });
  42 + tinymce.PluginManager.requireLangPack('lineheight', 'de');
  43 +};
  44 +
  45 +export default lineHeight;
... ...
src/components/Tinymce/src/plugins.ts
... ... @@ -4,7 +4,7 @@
4 4 // colorpicker/contextmenu/textcolor plugin is now built in to the core editor, please remove it from your editor configuration
5 5  
6 6 const plugins = [
7   - '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',
  7 + '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',
8 8 ];
9 9  
10 10 export default plugins;
... ...