mirror of
https://github.com/documize/community.git
synced 2025-07-30 10:39:44 +02:00
Update TinyMCE editor to v4.7.6 release
Fixes issue with double scroll bar and subsequent position of inline editing toolbar.
This commit is contained in:
parent
f967949513
commit
0f3de51ad5
156 changed files with 6555 additions and 69987 deletions
|
@ -1,220 +0,0 @@
|
|||
(function () {
|
||||
var legacyoutput = (function () {
|
||||
'use strict';
|
||||
|
||||
var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var overrideFormats = function (editor) {
|
||||
var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', fontSizes = Tools.explode(editor.settings.font_size_style_values), schema = editor.schema;
|
||||
editor.formatter.register({
|
||||
alignleft: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'left' }
|
||||
},
|
||||
aligncenter: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'center' }
|
||||
},
|
||||
alignright: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'right' }
|
||||
},
|
||||
alignjustify: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'justify' }
|
||||
},
|
||||
bold: [
|
||||
{
|
||||
inline: 'b',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'strong',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { fontWeight: 'bold' }
|
||||
}
|
||||
],
|
||||
italic: [
|
||||
{
|
||||
inline: 'i',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'em',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { fontStyle: 'italic' }
|
||||
}
|
||||
],
|
||||
underline: [
|
||||
{
|
||||
inline: 'u',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { textDecoration: 'underline' },
|
||||
exact: true
|
||||
}
|
||||
],
|
||||
strikethrough: [
|
||||
{
|
||||
inline: 'strike',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { textDecoration: 'line-through' },
|
||||
exact: true
|
||||
}
|
||||
],
|
||||
fontname: {
|
||||
inline: 'font',
|
||||
attributes: { face: '%value' }
|
||||
},
|
||||
fontsize: {
|
||||
inline: 'font',
|
||||
attributes: {
|
||||
size: function (vars) {
|
||||
return Tools.inArray(fontSizes, vars.value) + 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
forecolor: {
|
||||
inline: 'font',
|
||||
attributes: { color: '%value' }
|
||||
},
|
||||
hilitecolor: {
|
||||
inline: 'font',
|
||||
styles: { backgroundColor: '%value' }
|
||||
}
|
||||
});
|
||||
Tools.each('b,i,u,strike'.split(','), function (name) {
|
||||
schema.addValidElements(name + '[*]');
|
||||
});
|
||||
if (!schema.getElementRule('font')) {
|
||||
schema.addValidElements('font[face|size|color|style]');
|
||||
}
|
||||
Tools.each(alignElements.split(','), function (name) {
|
||||
var rule = schema.getElementRule(name);
|
||||
if (rule) {
|
||||
if (!rule.attributes.align) {
|
||||
rule.attributes.align = {};
|
||||
rule.attributesOrder.push('align');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
var setup = function (editor) {
|
||||
editor.settings.inline_styles = false;
|
||||
editor.on('init', function () {
|
||||
overrideFormats(editor);
|
||||
});
|
||||
};
|
||||
var $_44ln7he7jcun3yf4 = { setup: setup };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addButton('fontsizeselect', function () {
|
||||
var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7';
|
||||
var fontsizeFormats = editor.settings.fontsizeFormats || defaultFontsizeFormats;
|
||||
editor.$.each(fontsizeFormats.split(' '), function (i, item) {
|
||||
var text = item, value = item;
|
||||
var values = item.split('=');
|
||||
if (values.length > 1) {
|
||||
text = values[0];
|
||||
value = values[1];
|
||||
}
|
||||
items.push({
|
||||
text: text,
|
||||
value: value
|
||||
});
|
||||
});
|
||||
return {
|
||||
type: 'listbox',
|
||||
text: 'Font Sizes',
|
||||
tooltip: 'Font Sizes',
|
||||
values: items,
|
||||
fixedWidth: true,
|
||||
onPostRender: function () {
|
||||
var self = this;
|
||||
editor.on('NodeChange', function () {
|
||||
var fontElm;
|
||||
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
|
||||
if (fontElm) {
|
||||
self.value(fontElm.size);
|
||||
} else {
|
||||
self.value('');
|
||||
}
|
||||
});
|
||||
},
|
||||
onclick: function (e) {
|
||||
if (e.control.settings.value) {
|
||||
editor.execCommand('FontSize', false, e.control.settings.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
editor.addButton('fontselect', function () {
|
||||
function createFormats(formats) {
|
||||
formats = formats.replace(/;$/, '').split(';');
|
||||
var i = formats.length;
|
||||
while (i--) {
|
||||
formats[i] = formats[i].split('=');
|
||||
}
|
||||
return formats;
|
||||
}
|
||||
var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats';
|
||||
var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
|
||||
editor.$.each(fonts, function (i, font) {
|
||||
items.push({
|
||||
text: { raw: font[0] },
|
||||
value: font[1],
|
||||
textStyle: font[1].indexOf('dings') === -1 ? 'font-family:' + font[1] : ''
|
||||
});
|
||||
});
|
||||
return {
|
||||
type: 'listbox',
|
||||
text: 'Font Family',
|
||||
tooltip: 'Font Family',
|
||||
values: items,
|
||||
fixedWidth: true,
|
||||
onPostRender: function () {
|
||||
var self = this;
|
||||
editor.on('NodeChange', function () {
|
||||
var fontElm;
|
||||
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
|
||||
if (fontElm) {
|
||||
self.value(fontElm.face);
|
||||
} else {
|
||||
self.value('');
|
||||
}
|
||||
});
|
||||
},
|
||||
onselect: function (e) {
|
||||
if (e.control.settings.value) {
|
||||
editor.execCommand('FontName', false, e.control.settings.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
var $_1858kfe9jcun3yf8 = { register: register };
|
||||
|
||||
PluginManager.add('legacyoutput', function (editor) {
|
||||
$_44ln7he7jcun3yf4.setup(editor);
|
||||
$_1858kfe9jcun3yf8.register(editor);
|
||||
});
|
||||
var Plugin = function () {
|
||||
};
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})()
|
|
@ -1 +0,0 @@
|
|||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),n=function(e){e.settings.inline_styles=!1,e.on("init",function(){var n,i,a,o;n=e,i="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",a=t.explode(n.settings.font_size_style_values),o=n.schema,n.formatter.register({alignleft:{selector:i,attributes:{align:"left"}},aligncenter:{selector:i,attributes:{align:"center"}},alignright:{selector:i,attributes:{align:"right"}},alignjustify:{selector:i,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(e){return t.inArray(a,e.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),t.each("b,i,u,strike".split(","),function(e){o.addValidElements(e+"[*]")}),o.getElementRule("font")||o.addValidElements("font[face|size|color|style]"),t.each(i.split(","),function(e){var t=o.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})})},i=function(e){e.addButton("fontsizeselect",function(){var t=[],n=e.settings.fontsizeFormats||"8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7";return e.$.each(n.split(" "),function(e,n){var i=n,a=n,o=n.split("=");o.length>1&&(i=o[0],a=o[1]),t.push({text:i,value:a})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:t,fixedWidth:!0,onPostRender:function(){var t=this;e.on("NodeChange",function(){var n;(n=e.dom.getParent(e.selection.getNode(),"font"))?t.value(n.size):t.value("")})},onclick:function(t){t.control.settings.value&&e.execCommand("FontSize",!1,t.control.settings.value)}}}),e.addButton("fontselect",function(){var t=[],n=function(e){for(var t=(e=e.replace(/;$/,"").split(";")).length;t--;)e[t]=e[t].split("=");return e}(e.settings.font_formats||"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats");return e.$.each(n,function(e,n){t.push({text:{raw:n[0]},value:n[1],textStyle:-1===n[1].indexOf("dings")?"font-family:"+n[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:t,fixedWidth:!0,onPostRender:function(){var t=this;e.on("NodeChange",function(){var n;(n=e.dom.getParent(e.selection.getNode(),"font"))?t.value(n.face):t.value("")})},onselect:function(t){t.control.settings.value&&e.execCommand("FontName",!1,t.control.settings.value)}}})};e.add("legacyoutput",function(e){n(e),i(e)})}();
|
Loading…
Add table
Add a link
Reference in a new issue