Edit File by line
/home/barbar84/www/wp-inclu.../js/tinymce/themes/inlite
File: theme.js
(function () {
[0] Fix | Delete
var inlite = (function (domGlobals) {
[1] Fix | Delete
'use strict';
[2] Fix | Delete
[3] Fix | Delete
var global = tinymce.util.Tools.resolve('tinymce.ThemeManager');
[4] Fix | Delete
[5] Fix | Delete
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
[6] Fix | Delete
[7] Fix | Delete
var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
[8] Fix | Delete
[9] Fix | Delete
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay');
[10] Fix | Delete
[11] Fix | Delete
var flatten = function (arr) {
[12] Fix | Delete
return arr.reduce(function (results, item) {
[13] Fix | Delete
return Array.isArray(item) ? results.concat(flatten(item)) : results.concat(item);
[14] Fix | Delete
}, []);
[15] Fix | Delete
};
[16] Fix | Delete
var DeepFlatten = { flatten: flatten };
[17] Fix | Delete
[18] Fix | Delete
var result = function (id, rect) {
[19] Fix | Delete
return {
[20] Fix | Delete
id: id,
[21] Fix | Delete
rect: rect
[22] Fix | Delete
};
[23] Fix | Delete
};
[24] Fix | Delete
var match = function (editor, matchers) {
[25] Fix | Delete
for (var i = 0; i < matchers.length; i++) {
[26] Fix | Delete
var f = matchers[i];
[27] Fix | Delete
var result_1 = f(editor);
[28] Fix | Delete
if (result_1) {
[29] Fix | Delete
return result_1;
[30] Fix | Delete
}
[31] Fix | Delete
}
[32] Fix | Delete
return null;
[33] Fix | Delete
};
[34] Fix | Delete
var Matcher = {
[35] Fix | Delete
match: match,
[36] Fix | Delete
result: result
[37] Fix | Delete
};
[38] Fix | Delete
[39] Fix | Delete
var fromClientRect = function (clientRect) {
[40] Fix | Delete
return {
[41] Fix | Delete
x: clientRect.left,
[42] Fix | Delete
y: clientRect.top,
[43] Fix | Delete
w: clientRect.width,
[44] Fix | Delete
h: clientRect.height
[45] Fix | Delete
};
[46] Fix | Delete
};
[47] Fix | Delete
var toClientRect = function (geomRect) {
[48] Fix | Delete
return {
[49] Fix | Delete
left: geomRect.x,
[50] Fix | Delete
top: geomRect.y,
[51] Fix | Delete
width: geomRect.w,
[52] Fix | Delete
height: geomRect.h,
[53] Fix | Delete
right: geomRect.x + geomRect.w,
[54] Fix | Delete
bottom: geomRect.y + geomRect.h
[55] Fix | Delete
};
[56] Fix | Delete
};
[57] Fix | Delete
var Convert = {
[58] Fix | Delete
fromClientRect: fromClientRect,
[59] Fix | Delete
toClientRect: toClientRect
[60] Fix | Delete
};
[61] Fix | Delete
[62] Fix | Delete
var toAbsolute = function (rect) {
[63] Fix | Delete
var vp = global$2.DOM.getViewPort();
[64] Fix | Delete
return {
[65] Fix | Delete
x: rect.x + vp.x,
[66] Fix | Delete
y: rect.y + vp.y,
[67] Fix | Delete
w: rect.w,
[68] Fix | Delete
h: rect.h
[69] Fix | Delete
};
[70] Fix | Delete
};
[71] Fix | Delete
var measureElement = function (elm) {
[72] Fix | Delete
var clientRect = elm.getBoundingClientRect();
[73] Fix | Delete
return toAbsolute({
[74] Fix | Delete
x: clientRect.left,
[75] Fix | Delete
y: clientRect.top,
[76] Fix | Delete
w: Math.max(elm.clientWidth, elm.offsetWidth),
[77] Fix | Delete
h: Math.max(elm.clientHeight, elm.offsetHeight)
[78] Fix | Delete
});
[79] Fix | Delete
};
[80] Fix | Delete
var getElementRect = function (editor, elm) {
[81] Fix | Delete
return measureElement(elm);
[82] Fix | Delete
};
[83] Fix | Delete
var getPageAreaRect = function (editor) {
[84] Fix | Delete
return measureElement(editor.getElement().ownerDocument.body);
[85] Fix | Delete
};
[86] Fix | Delete
var getContentAreaRect = function (editor) {
[87] Fix | Delete
return measureElement(editor.getContentAreaContainer() || editor.getBody());
[88] Fix | Delete
};
[89] Fix | Delete
var getSelectionRect = function (editor) {
[90] Fix | Delete
var clientRect = editor.selection.getBoundingClientRect();
[91] Fix | Delete
return clientRect ? toAbsolute(Convert.fromClientRect(clientRect)) : null;
[92] Fix | Delete
};
[93] Fix | Delete
var Measure = {
[94] Fix | Delete
getElementRect: getElementRect,
[95] Fix | Delete
getPageAreaRect: getPageAreaRect,
[96] Fix | Delete
getContentAreaRect: getContentAreaRect,
[97] Fix | Delete
getSelectionRect: getSelectionRect
[98] Fix | Delete
};
[99] Fix | Delete
[100] Fix | Delete
var element = function (element, predicateIds) {
[101] Fix | Delete
return function (editor) {
[102] Fix | Delete
for (var i = 0; i < predicateIds.length; i++) {
[103] Fix | Delete
if (predicateIds[i].predicate(element)) {
[104] Fix | Delete
var result = Matcher.result(predicateIds[i].id, Measure.getElementRect(editor, element));
[105] Fix | Delete
return result;
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
return null;
[109] Fix | Delete
};
[110] Fix | Delete
};
[111] Fix | Delete
var parent = function (elements, predicateIds) {
[112] Fix | Delete
return function (editor) {
[113] Fix | Delete
for (var i = 0; i < elements.length; i++) {
[114] Fix | Delete
for (var x = 0; x < predicateIds.length; x++) {
[115] Fix | Delete
if (predicateIds[x].predicate(elements[i])) {
[116] Fix | Delete
return Matcher.result(predicateIds[x].id, Measure.getElementRect(editor, elements[i]));
[117] Fix | Delete
}
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
return null;
[121] Fix | Delete
};
[122] Fix | Delete
};
[123] Fix | Delete
var ElementMatcher = {
[124] Fix | Delete
element: element,
[125] Fix | Delete
parent: parent
[126] Fix | Delete
};
[127] Fix | Delete
[128] Fix | Delete
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
[129] Fix | Delete
[130] Fix | Delete
var create = function (id, predicate) {
[131] Fix | Delete
return {
[132] Fix | Delete
id: id,
[133] Fix | Delete
predicate: predicate
[134] Fix | Delete
};
[135] Fix | Delete
};
[136] Fix | Delete
var fromContextToolbars = function (toolbars) {
[137] Fix | Delete
return global$4.map(toolbars, function (toolbar) {
[138] Fix | Delete
return create(toolbar.id, toolbar.predicate);
[139] Fix | Delete
});
[140] Fix | Delete
};
[141] Fix | Delete
var PredicateId = {
[142] Fix | Delete
create: create,
[143] Fix | Delete
fromContextToolbars: fromContextToolbars
[144] Fix | Delete
};
[145] Fix | Delete
[146] Fix | Delete
var textSelection = function (id) {
[147] Fix | Delete
return function (editor) {
[148] Fix | Delete
if (!editor.selection.isCollapsed()) {
[149] Fix | Delete
var result = Matcher.result(id, Measure.getSelectionRect(editor));
[150] Fix | Delete
return result;
[151] Fix | Delete
}
[152] Fix | Delete
return null;
[153] Fix | Delete
};
[154] Fix | Delete
};
[155] Fix | Delete
var emptyTextBlock = function (elements, id) {
[156] Fix | Delete
return function (editor) {
[157] Fix | Delete
var i;
[158] Fix | Delete
var textBlockElementsMap = editor.schema.getTextBlockElements();
[159] Fix | Delete
for (i = 0; i < elements.length; i++) {
[160] Fix | Delete
if (elements[i].nodeName === 'TABLE') {
[161] Fix | Delete
return null;
[162] Fix | Delete
}
[163] Fix | Delete
}
[164] Fix | Delete
for (i = 0; i < elements.length; i++) {
[165] Fix | Delete
if (elements[i].nodeName in textBlockElementsMap) {
[166] Fix | Delete
if (editor.dom.isEmpty(elements[i])) {
[167] Fix | Delete
return Matcher.result(id, Measure.getSelectionRect(editor));
[168] Fix | Delete
}
[169] Fix | Delete
return null;
[170] Fix | Delete
}
[171] Fix | Delete
}
[172] Fix | Delete
return null;
[173] Fix | Delete
};
[174] Fix | Delete
};
[175] Fix | Delete
var SelectionMatcher = {
[176] Fix | Delete
textSelection: textSelection,
[177] Fix | Delete
emptyTextBlock: emptyTextBlock
[178] Fix | Delete
};
[179] Fix | Delete
[180] Fix | Delete
var fireSkinLoaded = function (editor) {
[181] Fix | Delete
editor.fire('SkinLoaded');
[182] Fix | Delete
};
[183] Fix | Delete
var fireBeforeRenderUI = function (editor) {
[184] Fix | Delete
return editor.fire('BeforeRenderUI');
[185] Fix | Delete
};
[186] Fix | Delete
var Events = {
[187] Fix | Delete
fireSkinLoaded: fireSkinLoaded,
[188] Fix | Delete
fireBeforeRenderUI: fireBeforeRenderUI
[189] Fix | Delete
};
[190] Fix | Delete
[191] Fix | Delete
var global$5 = tinymce.util.Tools.resolve('tinymce.EditorManager');
[192] Fix | Delete
[193] Fix | Delete
var isType = function (type) {
[194] Fix | Delete
return function (value) {
[195] Fix | Delete
return typeof value === type;
[196] Fix | Delete
};
[197] Fix | Delete
};
[198] Fix | Delete
var isArray = function (value) {
[199] Fix | Delete
return Array.isArray(value);
[200] Fix | Delete
};
[201] Fix | Delete
var isNull = function (value) {
[202] Fix | Delete
return value === null;
[203] Fix | Delete
};
[204] Fix | Delete
var isObject = function (predicate) {
[205] Fix | Delete
return function (value) {
[206] Fix | Delete
return !isNull(value) && !isArray(value) && predicate(value);
[207] Fix | Delete
};
[208] Fix | Delete
};
[209] Fix | Delete
var isString = function (value) {
[210] Fix | Delete
return isType('string')(value);
[211] Fix | Delete
};
[212] Fix | Delete
var isNumber = function (value) {
[213] Fix | Delete
return isType('number')(value);
[214] Fix | Delete
};
[215] Fix | Delete
var isFunction = function (value) {
[216] Fix | Delete
return isType('function')(value);
[217] Fix | Delete
};
[218] Fix | Delete
var isBoolean = function (value) {
[219] Fix | Delete
return isType('boolean')(value);
[220] Fix | Delete
};
[221] Fix | Delete
var Type = {
[222] Fix | Delete
isString: isString,
[223] Fix | Delete
isNumber: isNumber,
[224] Fix | Delete
isBoolean: isBoolean,
[225] Fix | Delete
isFunction: isFunction,
[226] Fix | Delete
isObject: isObject(isType('object')),
[227] Fix | Delete
isNull: isNull,
[228] Fix | Delete
isArray: isArray
[229] Fix | Delete
};
[230] Fix | Delete
[231] Fix | Delete
var validDefaultOrDie = function (value, predicate) {
[232] Fix | Delete
if (predicate(value)) {
[233] Fix | Delete
return true;
[234] Fix | Delete
}
[235] Fix | Delete
throw new Error('Default value doesn\'t match requested type.');
[236] Fix | Delete
};
[237] Fix | Delete
var getByTypeOr = function (predicate) {
[238] Fix | Delete
return function (editor, name, defaultValue) {
[239] Fix | Delete
var settings = editor.settings;
[240] Fix | Delete
validDefaultOrDie(defaultValue, predicate);
[241] Fix | Delete
return name in settings && predicate(settings[name]) ? settings[name] : defaultValue;
[242] Fix | Delete
};
[243] Fix | Delete
};
[244] Fix | Delete
var splitNoEmpty = function (str, delim) {
[245] Fix | Delete
return str.split(delim).filter(function (item) {
[246] Fix | Delete
return item.length > 0;
[247] Fix | Delete
});
[248] Fix | Delete
};
[249] Fix | Delete
var itemsToArray = function (value, defaultValue) {
[250] Fix | Delete
var stringToItemsArray = function (value) {
[251] Fix | Delete
return typeof value === 'string' ? splitNoEmpty(value, /[ ,]/) : value;
[252] Fix | Delete
};
[253] Fix | Delete
var boolToItemsArray = function (value, defaultValue) {
[254] Fix | Delete
return value === false ? [] : defaultValue;
[255] Fix | Delete
};
[256] Fix | Delete
if (Type.isArray(value)) {
[257] Fix | Delete
return value;
[258] Fix | Delete
} else if (Type.isString(value)) {
[259] Fix | Delete
return stringToItemsArray(value);
[260] Fix | Delete
} else if (Type.isBoolean(value)) {
[261] Fix | Delete
return boolToItemsArray(value, defaultValue);
[262] Fix | Delete
}
[263] Fix | Delete
return defaultValue;
[264] Fix | Delete
};
[265] Fix | Delete
var getToolbarItemsOr = function (predicate) {
[266] Fix | Delete
return function (editor, name, defaultValue) {
[267] Fix | Delete
var value = name in editor.settings ? editor.settings[name] : defaultValue;
[268] Fix | Delete
validDefaultOrDie(defaultValue, predicate);
[269] Fix | Delete
return itemsToArray(value, defaultValue);
[270] Fix | Delete
};
[271] Fix | Delete
};
[272] Fix | Delete
var EditorSettings = {
[273] Fix | Delete
getStringOr: getByTypeOr(Type.isString),
[274] Fix | Delete
getBoolOr: getByTypeOr(Type.isBoolean),
[275] Fix | Delete
getNumberOr: getByTypeOr(Type.isNumber),
[276] Fix | Delete
getHandlerOr: getByTypeOr(Type.isFunction),
[277] Fix | Delete
getToolbarItemsOr: getToolbarItemsOr(Type.isArray)
[278] Fix | Delete
};
[279] Fix | Delete
[280] Fix | Delete
var global$6 = tinymce.util.Tools.resolve('tinymce.geom.Rect');
[281] Fix | Delete
[282] Fix | Delete
var result$1 = function (rect, position) {
[283] Fix | Delete
return {
[284] Fix | Delete
rect: rect,
[285] Fix | Delete
position: position
[286] Fix | Delete
};
[287] Fix | Delete
};
[288] Fix | Delete
var moveTo = function (rect, toRect) {
[289] Fix | Delete
return {
[290] Fix | Delete
x: toRect.x,
[291] Fix | Delete
y: toRect.y,
[292] Fix | Delete
w: rect.w,
[293] Fix | Delete
h: rect.h
[294] Fix | Delete
};
[295] Fix | Delete
};
[296] Fix | Delete
var calcByPositions = function (testPositions1, testPositions2, targetRect, contentAreaRect, panelRect) {
[297] Fix | Delete
var relPos, relRect, outputPanelRect;
[298] Fix | Delete
var paddedContentRect = {
[299] Fix | Delete
x: contentAreaRect.x,
[300] Fix | Delete
y: contentAreaRect.y,
[301] Fix | Delete
w: contentAreaRect.w + (contentAreaRect.w < panelRect.w + targetRect.w ? panelRect.w : 0),
[302] Fix | Delete
h: contentAreaRect.h + (contentAreaRect.h < panelRect.h + targetRect.h ? panelRect.h : 0)
[303] Fix | Delete
};
[304] Fix | Delete
relPos = global$6.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions1);
[305] Fix | Delete
targetRect = global$6.clamp(targetRect, paddedContentRect);
[306] Fix | Delete
if (relPos) {
[307] Fix | Delete
relRect = global$6.relativePosition(panelRect, targetRect, relPos);
[308] Fix | Delete
outputPanelRect = moveTo(panelRect, relRect);
[309] Fix | Delete
return result$1(outputPanelRect, relPos);
[310] Fix | Delete
}
[311] Fix | Delete
targetRect = global$6.intersect(paddedContentRect, targetRect);
[312] Fix | Delete
if (targetRect) {
[313] Fix | Delete
relPos = global$6.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions2);
[314] Fix | Delete
if (relPos) {
[315] Fix | Delete
relRect = global$6.relativePosition(panelRect, targetRect, relPos);
[316] Fix | Delete
outputPanelRect = moveTo(panelRect, relRect);
[317] Fix | Delete
return result$1(outputPanelRect, relPos);
[318] Fix | Delete
}
[319] Fix | Delete
outputPanelRect = moveTo(panelRect, targetRect);
[320] Fix | Delete
return result$1(outputPanelRect, relPos);
[321] Fix | Delete
}
[322] Fix | Delete
return null;
[323] Fix | Delete
};
[324] Fix | Delete
var calcInsert = function (targetRect, contentAreaRect, panelRect) {
[325] Fix | Delete
return calcByPositions([
[326] Fix | Delete
'cr-cl',
[327] Fix | Delete
'cl-cr'
[328] Fix | Delete
], [
[329] Fix | Delete
'bc-tc',
[330] Fix | Delete
'bl-tl',
[331] Fix | Delete
'br-tr'
[332] Fix | Delete
], targetRect, contentAreaRect, panelRect);
[333] Fix | Delete
};
[334] Fix | Delete
var calc = function (targetRect, contentAreaRect, panelRect) {
[335] Fix | Delete
return calcByPositions([
[336] Fix | Delete
'tc-bc',
[337] Fix | Delete
'bc-tc',
[338] Fix | Delete
'tl-bl',
[339] Fix | Delete
'bl-tl',
[340] Fix | Delete
'tr-br',
[341] Fix | Delete
'br-tr',
[342] Fix | Delete
'cr-cl',
[343] Fix | Delete
'cl-cr'
[344] Fix | Delete
], [
[345] Fix | Delete
'bc-tc',
[346] Fix | Delete
'bl-tl',
[347] Fix | Delete
'br-tr',
[348] Fix | Delete
'cr-cl'
[349] Fix | Delete
], targetRect, contentAreaRect, panelRect);
[350] Fix | Delete
};
[351] Fix | Delete
var userConstrain = function (handler, targetRect, contentAreaRect, panelRect) {
[352] Fix | Delete
var userConstrainedPanelRect;
[353] Fix | Delete
if (typeof handler === 'function') {
[354] Fix | Delete
userConstrainedPanelRect = handler({
[355] Fix | Delete
elementRect: Convert.toClientRect(targetRect),
[356] Fix | Delete
contentAreaRect: Convert.toClientRect(contentAreaRect),
[357] Fix | Delete
panelRect: Convert.toClientRect(panelRect)
[358] Fix | Delete
});
[359] Fix | Delete
return Convert.fromClientRect(userConstrainedPanelRect);
[360] Fix | Delete
}
[361] Fix | Delete
return panelRect;
[362] Fix | Delete
};
[363] Fix | Delete
var defaultHandler = function (rects) {
[364] Fix | Delete
return rects.panelRect;
[365] Fix | Delete
};
[366] Fix | Delete
var Layout = {
[367] Fix | Delete
calcInsert: calcInsert,
[368] Fix | Delete
calc: calc,
[369] Fix | Delete
userConstrain: userConstrain,
[370] Fix | Delete
defaultHandler: defaultHandler
[371] Fix | Delete
};
[372] Fix | Delete
[373] Fix | Delete
var toAbsoluteUrl = function (editor, url) {
[374] Fix | Delete
return editor.documentBaseURI.toAbsolute(url);
[375] Fix | Delete
};
[376] Fix | Delete
var urlFromName = function (name) {
[377] Fix | Delete
var prefix = global$5.baseURL + '/skins/';
[378] Fix | Delete
return name ? prefix + name : prefix + 'lightgray';
[379] Fix | Delete
};
[380] Fix | Delete
var getTextSelectionToolbarItems = function (editor) {
[381] Fix | Delete
return EditorSettings.getToolbarItemsOr(editor, 'selection_toolbar', [
[382] Fix | Delete
'bold',
[383] Fix | Delete
'italic',
[384] Fix | Delete
'|',
[385] Fix | Delete
'quicklink',
[386] Fix | Delete
'h2',
[387] Fix | Delete
'h3',
[388] Fix | Delete
'blockquote'
[389] Fix | Delete
]);
[390] Fix | Delete
};
[391] Fix | Delete
var getInsertToolbarItems = function (editor) {
[392] Fix | Delete
return EditorSettings.getToolbarItemsOr(editor, 'insert_toolbar', [
[393] Fix | Delete
'quickimage',
[394] Fix | Delete
'quicktable'
[395] Fix | Delete
]);
[396] Fix | Delete
};
[397] Fix | Delete
var getPositionHandler = function (editor) {
[398] Fix | Delete
return EditorSettings.getHandlerOr(editor, 'inline_toolbar_position_handler', Layout.defaultHandler);
[399] Fix | Delete
};
[400] Fix | Delete
var getSkinUrl = function (editor) {
[401] Fix | Delete
var settings = editor.settings;
[402] Fix | Delete
return settings.skin_url ? toAbsoluteUrl(editor, settings.skin_url) : urlFromName(settings.skin);
[403] Fix | Delete
};
[404] Fix | Delete
var isSkinDisabled = function (editor) {
[405] Fix | Delete
return editor.settings.skin === false;
[406] Fix | Delete
};
[407] Fix | Delete
var Settings = {
[408] Fix | Delete
getTextSelectionToolbarItems: getTextSelectionToolbarItems,
[409] Fix | Delete
getInsertToolbarItems: getInsertToolbarItems,
[410] Fix | Delete
getPositionHandler: getPositionHandler,
[411] Fix | Delete
getSkinUrl: getSkinUrl,
[412] Fix | Delete
isSkinDisabled: isSkinDisabled
[413] Fix | Delete
};
[414] Fix | Delete
[415] Fix | Delete
var fireSkinLoaded$1 = function (editor, callback) {
[416] Fix | Delete
var done = function () {
[417] Fix | Delete
editor._skinLoaded = true;
[418] Fix | Delete
Events.fireSkinLoaded(editor);
[419] Fix | Delete
callback();
[420] Fix | Delete
};
[421] Fix | Delete
if (editor.initialized) {
[422] Fix | Delete
done();
[423] Fix | Delete
} else {
[424] Fix | Delete
editor.on('init', done);
[425] Fix | Delete
}
[426] Fix | Delete
};
[427] Fix | Delete
var load = function (editor, callback) {
[428] Fix | Delete
var skinUrl = Settings.getSkinUrl(editor);
[429] Fix | Delete
var done = function () {
[430] Fix | Delete
fireSkinLoaded$1(editor, callback);
[431] Fix | Delete
};
[432] Fix | Delete
if (Settings.isSkinDisabled(editor)) {
[433] Fix | Delete
done();
[434] Fix | Delete
} else {
[435] Fix | Delete
global$2.DOM.styleSheetLoader.load(skinUrl + '/skin.min.css', done);
[436] Fix | Delete
editor.contentCSS.push(skinUrl + '/content.inline.min.css');
[437] Fix | Delete
}
[438] Fix | Delete
};
[439] Fix | Delete
var SkinLoader = { load: load };
[440] Fix | Delete
[441] Fix | Delete
var getSelectionElements = function (editor) {
[442] Fix | Delete
var node = editor.selection.getNode();
[443] Fix | Delete
var elms = editor.dom.getParents(node, '*');
[444] Fix | Delete
return elms;
[445] Fix | Delete
};
[446] Fix | Delete
var createToolbar = function (editor, selector, id, items) {
[447] Fix | Delete
var selectorPredicate = function (elm) {
[448] Fix | Delete
return editor.dom.is(elm, selector);
[449] Fix | Delete
};
[450] Fix | Delete
return {
[451] Fix | Delete
predicate: selectorPredicate,
[452] Fix | Delete
id: id,
[453] Fix | Delete
items: items
[454] Fix | Delete
};
[455] Fix | Delete
};
[456] Fix | Delete
var getToolbars = function (editor) {
[457] Fix | Delete
var contextToolbars = editor.contextToolbars;
[458] Fix | Delete
return DeepFlatten.flatten([
[459] Fix | Delete
contextToolbars ? contextToolbars : [],
[460] Fix | Delete
createToolbar(editor, 'img', 'image', 'alignleft aligncenter alignright')
[461] Fix | Delete
]);
[462] Fix | Delete
};
[463] Fix | Delete
var findMatchResult = function (editor, toolbars) {
[464] Fix | Delete
var result, elements, contextToolbarsPredicateIds;
[465] Fix | Delete
elements = getSelectionElements(editor);
[466] Fix | Delete
contextToolbarsPredicateIds = PredicateId.fromContextToolbars(toolbars);
[467] Fix | Delete
result = Matcher.match(editor, [
[468] Fix | Delete
ElementMatcher.element(elements[0], contextToolbarsPredicateIds),
[469] Fix | Delete
SelectionMatcher.textSelection('text'),
[470] Fix | Delete
SelectionMatcher.emptyTextBlock(elements, 'insert'),
[471] Fix | Delete
ElementMatcher.parent(elements, contextToolbarsPredicateIds)
[472] Fix | Delete
]);
[473] Fix | Delete
return result && result.rect ? result : null;
[474] Fix | Delete
};
[475] Fix | Delete
var editorHasFocus = function (editor) {
[476] Fix | Delete
return domGlobals.document.activeElement === editor.getBody();
[477] Fix | Delete
};
[478] Fix | Delete
var togglePanel = function (editor, panel) {
[479] Fix | Delete
var toggle = function () {
[480] Fix | Delete
var toolbars = getToolbars(editor);
[481] Fix | Delete
var result = findMatchResult(editor, toolbars);
[482] Fix | Delete
if (result) {
[483] Fix | Delete
panel.show(editor, result.id, result.rect, toolbars);
[484] Fix | Delete
} else {
[485] Fix | Delete
panel.hide();
[486] Fix | Delete
}
[487] Fix | Delete
};
[488] Fix | Delete
return function () {
[489] Fix | Delete
if (!editor.removed && editorHasFocus(editor)) {
[490] Fix | Delete
toggle();
[491] Fix | Delete
}
[492] Fix | Delete
};
[493] Fix | Delete
};
[494] Fix | Delete
var repositionPanel = function (editor, panel) {
[495] Fix | Delete
return function () {
[496] Fix | Delete
var toolbars = getToolbars(editor);
[497] Fix | Delete
var result = findMatchResult(editor, toolbars);
[498] Fix | Delete
if (result) {
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function