4 changed files with 49 additions and 48 deletions
@ -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; |
|
||||
@ -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; |
||||
Loading…
Reference in new issue