var inlite = (function (domGlobals) {
var global = tinymce.util.Tools.resolve('tinymce.ThemeManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay');
var flatten = function (arr) {
return arr.reduce(function (results, item) {
return Array.isArray(item) ? results.concat(flatten(item)) : results.concat(item);
var DeepFlatten = { flatten: flatten };
var result = function (id, rect) {
var match = function (editor, matchers) {
for (var i = 0; i < matchers.length; i++) {
var result_1 = f(editor);
var fromClientRect = function (clientRect) {
var toClientRect = function (geomRect) {
right: geomRect.x + geomRect.w,
bottom: geomRect.y + geomRect.h
fromClientRect: fromClientRect,
toClientRect: toClientRect
var toAbsolute = function (rect) {
var vp = global$2.DOM.getViewPort();
var measureElement = function (elm) {
var clientRect = elm.getBoundingClientRect();
w: Math.max(elm.clientWidth, elm.offsetWidth),
h: Math.max(elm.clientHeight, elm.offsetHeight)
var getElementRect = function (editor, elm) {
return measureElement(elm);
var getPageAreaRect = function (editor) {
return measureElement(editor.getElement().ownerDocument.body);
var getContentAreaRect = function (editor) {
return measureElement(editor.getContentAreaContainer() || editor.getBody());
var getSelectionRect = function (editor) {
var clientRect = editor.selection.getBoundingClientRect();
return clientRect ? toAbsolute(Convert.fromClientRect(clientRect)) : null;
getElementRect: getElementRect,
getPageAreaRect: getPageAreaRect,
getContentAreaRect: getContentAreaRect,
getSelectionRect: getSelectionRect
var element = function (element, predicateIds) {
return function (editor) {
for (var i = 0; i < predicateIds.length; i++) {
if (predicateIds[i].predicate(element)) {
var result = Matcher.result(predicateIds[i].id, Measure.getElementRect(editor, element));
var parent = function (elements, predicateIds) {
return function (editor) {
for (var i = 0; i < elements.length; i++) {
for (var x = 0; x < predicateIds.length; x++) {
if (predicateIds[x].predicate(elements[i])) {
return Matcher.result(predicateIds[x].id, Measure.getElementRect(editor, elements[i]));
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var create = function (id, predicate) {
var fromContextToolbars = function (toolbars) {
return global$4.map(toolbars, function (toolbar) {
return create(toolbar.id, toolbar.predicate);
fromContextToolbars: fromContextToolbars
var textSelection = function (id) {
return function (editor) {
if (!editor.selection.isCollapsed()) {
var result = Matcher.result(id, Measure.getSelectionRect(editor));
var emptyTextBlock = function (elements, id) {
return function (editor) {
var textBlockElementsMap = editor.schema.getTextBlockElements();
for (i = 0; i < elements.length; i++) {
if (elements[i].nodeName === 'TABLE') {
for (i = 0; i < elements.length; i++) {
if (elements[i].nodeName in textBlockElementsMap) {
if (editor.dom.isEmpty(elements[i])) {
return Matcher.result(id, Measure.getSelectionRect(editor));
textSelection: textSelection,
emptyTextBlock: emptyTextBlock
var fireSkinLoaded = function (editor) {
editor.fire('SkinLoaded');
var fireBeforeRenderUI = function (editor) {
return editor.fire('BeforeRenderUI');
fireSkinLoaded: fireSkinLoaded,
fireBeforeRenderUI: fireBeforeRenderUI
var global$5 = tinymce.util.Tools.resolve('tinymce.EditorManager');
var isType = function (type) {
return function (value) {
return typeof value === type;
var isArray = function (value) {
return Array.isArray(value);
var isNull = function (value) {
var isObject = function (predicate) {
return function (value) {
return !isNull(value) && !isArray(value) && predicate(value);
var isString = function (value) {
return isType('string')(value);
var isNumber = function (value) {
return isType('number')(value);
var isFunction = function (value) {
return isType('function')(value);
var isBoolean = function (value) {
return isType('boolean')(value);
isObject: isObject(isType('object')),
var validDefaultOrDie = function (value, predicate) {
throw new Error('Default value doesn\'t match requested type.');
var getByTypeOr = function (predicate) {
return function (editor, name, defaultValue) {
var settings = editor.settings;
validDefaultOrDie(defaultValue, predicate);
return name in settings && predicate(settings[name]) ? settings[name] : defaultValue;
var splitNoEmpty = function (str, delim) {
return str.split(delim).filter(function (item) {
var itemsToArray = function (value, defaultValue) {
var stringToItemsArray = function (value) {
return typeof value === 'string' ? splitNoEmpty(value, /[ ,]/) : value;
var boolToItemsArray = function (value, defaultValue) {
return value === false ? [] : defaultValue;
if (Type.isArray(value)) {
} else if (Type.isString(value)) {
return stringToItemsArray(value);
} else if (Type.isBoolean(value)) {
return boolToItemsArray(value, defaultValue);
var getToolbarItemsOr = function (predicate) {
return function (editor, name, defaultValue) {
var value = name in editor.settings ? editor.settings[name] : defaultValue;
validDefaultOrDie(defaultValue, predicate);
return itemsToArray(value, defaultValue);
getStringOr: getByTypeOr(Type.isString),
getBoolOr: getByTypeOr(Type.isBoolean),
getNumberOr: getByTypeOr(Type.isNumber),
getHandlerOr: getByTypeOr(Type.isFunction),
getToolbarItemsOr: getToolbarItemsOr(Type.isArray)
var global$6 = tinymce.util.Tools.resolve('tinymce.geom.Rect');
var result$1 = function (rect, position) {
var moveTo = function (rect, toRect) {
var calcByPositions = function (testPositions1, testPositions2, targetRect, contentAreaRect, panelRect) {
var relPos, relRect, outputPanelRect;
var paddedContentRect = {
w: contentAreaRect.w + (contentAreaRect.w < panelRect.w + targetRect.w ? panelRect.w : 0),
h: contentAreaRect.h + (contentAreaRect.h < panelRect.h + targetRect.h ? panelRect.h : 0)
relPos = global$6.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions1);
targetRect = global$6.clamp(targetRect, paddedContentRect);
relRect = global$6.relativePosition(panelRect, targetRect, relPos);
outputPanelRect = moveTo(panelRect, relRect);
return result$1(outputPanelRect, relPos);
targetRect = global$6.intersect(paddedContentRect, targetRect);
relPos = global$6.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions2);
relRect = global$6.relativePosition(panelRect, targetRect, relPos);
outputPanelRect = moveTo(panelRect, relRect);
return result$1(outputPanelRect, relPos);
outputPanelRect = moveTo(panelRect, targetRect);
return result$1(outputPanelRect, relPos);
var calcInsert = function (targetRect, contentAreaRect, panelRect) {
], targetRect, contentAreaRect, panelRect);
var calc = function (targetRect, contentAreaRect, panelRect) {
], targetRect, contentAreaRect, panelRect);
var userConstrain = function (handler, targetRect, contentAreaRect, panelRect) {
var userConstrainedPanelRect;
if (typeof handler === 'function') {
userConstrainedPanelRect = handler({
elementRect: Convert.toClientRect(targetRect),
contentAreaRect: Convert.toClientRect(contentAreaRect),
panelRect: Convert.toClientRect(panelRect)
return Convert.fromClientRect(userConstrainedPanelRect);
var defaultHandler = function (rects) {
userConstrain: userConstrain,
defaultHandler: defaultHandler
var toAbsoluteUrl = function (editor, url) {
return editor.documentBaseURI.toAbsolute(url);
var urlFromName = function (name) {
var prefix = global$5.baseURL + '/skins/';
return name ? prefix + name : prefix + 'lightgray';
var getTextSelectionToolbarItems = function (editor) {
return EditorSettings.getToolbarItemsOr(editor, 'selection_toolbar', [
var getInsertToolbarItems = function (editor) {
return EditorSettings.getToolbarItemsOr(editor, 'insert_toolbar', [
var getPositionHandler = function (editor) {
return EditorSettings.getHandlerOr(editor, 'inline_toolbar_position_handler', Layout.defaultHandler);
var getSkinUrl = function (editor) {
var settings = editor.settings;
return settings.skin_url ? toAbsoluteUrl(editor, settings.skin_url) : urlFromName(settings.skin);
var isSkinDisabled = function (editor) {
return editor.settings.skin === false;
getTextSelectionToolbarItems: getTextSelectionToolbarItems,
getInsertToolbarItems: getInsertToolbarItems,
getPositionHandler: getPositionHandler,
isSkinDisabled: isSkinDisabled
var fireSkinLoaded$1 = function (editor, callback) {
editor._skinLoaded = true;
Events.fireSkinLoaded(editor);
if (editor.initialized) {
var load = function (editor, callback) {
var skinUrl = Settings.getSkinUrl(editor);
fireSkinLoaded$1(editor, callback);
if (Settings.isSkinDisabled(editor)) {
global$2.DOM.styleSheetLoader.load(skinUrl + '/skin.min.css', done);
editor.contentCSS.push(skinUrl + '/content.inline.min.css');
var SkinLoader = { load: load };
var getSelectionElements = function (editor) {
var node = editor.selection.getNode();
var elms = editor.dom.getParents(node, '*');
var createToolbar = function (editor, selector, id, items) {
var selectorPredicate = function (elm) {
return editor.dom.is(elm, selector);
predicate: selectorPredicate,
var getToolbars = function (editor) {
var contextToolbars = editor.contextToolbars;
return DeepFlatten.flatten([
contextToolbars ? contextToolbars : [],
createToolbar(editor, 'img', 'image', 'alignleft aligncenter alignright')
var findMatchResult = function (editor, toolbars) {
var result, elements, contextToolbarsPredicateIds;
elements = getSelectionElements(editor);
contextToolbarsPredicateIds = PredicateId.fromContextToolbars(toolbars);
result = Matcher.match(editor, [
ElementMatcher.element(elements[0], contextToolbarsPredicateIds),
SelectionMatcher.textSelection('text'),
SelectionMatcher.emptyTextBlock(elements, 'insert'),
ElementMatcher.parent(elements, contextToolbarsPredicateIds)
return result && result.rect ? result : null;
var editorHasFocus = function (editor) {
return domGlobals.document.activeElement === editor.getBody();
var togglePanel = function (editor, panel) {
var toggle = function () {
var toolbars = getToolbars(editor);
var result = findMatchResult(editor, toolbars);
panel.show(editor, result.id, result.rect, toolbars);
if (!editor.removed && editorHasFocus(editor)) {
var repositionPanel = function (editor, panel) {
var toolbars = getToolbars(editor);
var result = findMatchResult(editor, toolbars);