if (self.state.get('active')) {
var Progress = Widget.extend({
init: function (settings) {
self.classes.add('progress');
if (!self.settings.filter) {
self.settings.filter = function (value) {
return Math.round(value);
renderHtml: function () {
var self = this, id = self._id, prefix = this.classPrefix;
return '<div id="' + id + '" class="' + self.classes + '">' + '<div class="' + prefix + 'bar-container">' + '<div class="' + prefix + 'bar"></div>' + '</div>' + '<div class="' + prefix + 'text">0%</div>' + '</div>';
postRender: function () {
self.value(self.settings.value);
bindStates: function () {
function setValue(value) {
value = self.settings.filter(value);
self.getEl().lastChild.innerHTML = value + '%';
self.getEl().firstChild.firstChild.style.width = value + '%';
self.state.on('change:value', function (e) {
setValue(self.state.get('value'));
var updateLiveRegion = function (ctx, text) {
ctx.getEl().lastChild.textContent = text + (ctx.progressBar ? ' ' + ctx.progressBar.value() + '%' : '');
var Notification = Control$1.extend({
Defaults: { classes: 'widget notification' },
init: function (settings) {
self.maxWidth = settings.maxWidth;
self.text(settings.text);
self.icon = settings.icon;
self.color = settings.color;
self.classes.add('notification-' + settings.type);
if (settings.timeout && (settings.timeout < 0 || settings.timeout > 0) && !settings.closeButton) {
self.closeButton = false;
self.classes.add('has-close');
if (settings.progressBar) {
self.progressBar = new Progress();
self.on('click', function (e) {
if (e.target.className.indexOf(self.classPrefix + 'close') !== -1) {
renderHtml: function () {
var prefix = self.classPrefix;
var icon = '', closeButton = '', progressBar = '', notificationStyle = '';
icon = '<i class="' + prefix + 'ico' + ' ' + prefix + 'i-' + self.icon + '"></i>';
notificationStyle = ' style="max-width: ' + self.maxWidth + 'px;' + (self.color ? 'background-color: ' + self.color + ';"' : '"');
closeButton = '<button type="button" class="' + prefix + 'close" aria-hidden="true">\xD7</button>';
progressBar = self.progressBar.renderHtml();
return '<div id="' + self._id + '" class="' + self.classes + '"' + notificationStyle + ' role="presentation">' + icon + '<div class="' + prefix + 'notification-inner">' + self.state.get('text') + '</div>' + progressBar + closeButton + '<div style="clip: rect(1px, 1px, 1px, 1px);height: 1px;overflow: hidden;position: absolute;width: 1px;"' + ' aria-live="assertive" aria-relevant="additions" aria-atomic="true"></div>' + '</div>';
postRender: function () {
global$3.setTimeout(function () {
self.$el.addClass(self.classPrefix + 'in');
updateLiveRegion(self, self.state.get('text'));
bindStates: function () {
self.state.on('change:text', function (e) {
self.getEl().firstChild.innerHTML = e.value;
updateLiveRegion(self, e.value);
self.progressBar.bindStates();
self.progressBar.state.on('change:value', function (e) {
updateLiveRegion(self, self.state.get('text'));
if (!self.fire('close').isDefaultPrevented()) {
style = self.getEl().style;
style.left = rect.x + 'px';
style.top = rect.y + 'px';
style.zIndex = 65535 - 1;
function NotificationManagerImpl (editor) {
var getEditorContainer = function (editor) {
return editor.inline ? editor.getElement() : editor.getContentAreaContainer();
var getContainerWidth = function () {
var container = getEditorContainer(editor);
return funcs.getSize(container).width;
var prePositionNotifications = function (notifications) {
each(notifications, function (notification) {
notification.moveTo(0, 0);
var positionNotifications = function (notifications) {
if (notifications.length > 0) {
var firstItem = notifications.slice(0, 1)[0];
var container = getEditorContainer(editor);
firstItem.moveRel(container, 'tc-tc');
each(notifications, function (notification, index) {
notification.moveRel(notifications[index - 1].getEl(), 'bc-tc');
var reposition = function (notifications) {
prePositionNotifications(notifications);
positionNotifications(notifications);
var open = function (args, closeCallback) {
var extendedArgs = global$4.extend(args, { maxWidth: getContainerWidth() });
var notif = new Notification(extendedArgs);
notif.args = extendedArgs;
if (extendedArgs.timeout > 0) {
notif.timer = setTimeout(function () {
}, extendedArgs.timeout);
notif.on('close', function () {
var close = function (notification) {
var getArgs = function (notification) {
return notification.args;
function getDocumentSize(doc) {
var documentElement, body, scrollWidth, clientWidth;
var offsetWidth, scrollHeight, clientHeight, offsetHeight;
documentElement = doc.documentElement;
scrollWidth = max(documentElement.scrollWidth, body.scrollWidth);
clientWidth = max(documentElement.clientWidth, body.clientWidth);
offsetWidth = max(documentElement.offsetWidth, body.offsetWidth);
scrollHeight = max(documentElement.scrollHeight, body.scrollHeight);
clientHeight = max(documentElement.clientHeight, body.clientHeight);
offsetHeight = max(documentElement.offsetHeight, body.offsetHeight);
width: scrollWidth < offsetWidth ? clientWidth : scrollWidth,
height: scrollHeight < offsetHeight ? clientHeight : scrollHeight
function updateWithTouchData(e) {
keys = 'screenX screenY pageX pageY clientX clientY'.split(' ');
for (i = 0; i < keys.length; i++) {
e[keys[i]] = e.changedTouches[0][keys[i]];
function DragHelper (id, settings) {
var doc = settings.document || domGlobals.document;
var start, stop, drag, startX, startY;
settings = settings || {};
var handleElement = doc.getElementById(settings.handle || id);
var docSize = getDocumentSize(doc);
handleElm = handleElement;
if (domGlobals.window.getComputedStyle) {
cursor = domGlobals.window.getComputedStyle(handleElm, null).getPropertyValue('cursor');
cursor = handleElm.runtimeStyle.cursor;
$eventOverlay = global$7('<div></div>').css({
global$7(doc).on('mousemove touchmove', drag).on('mouseup touchend', stop);
if (e.button !== downButton) {
e.deltaX = e.screenX - startX;
e.deltaY = e.screenY - startY;
global$7(doc).off('mousemove touchmove', drag).off('mouseup touchend', stop);
this.destroy = function () {
global$7(handleElement).off();
global$7(handleElement).on('mousedown touchstart', start);
var global$b = tinymce.util.Tools.resolve('tinymce.ui.Factory');
var hasTabstopData = function (elm) {
return elm.getAttribute('data-mce-tabstop') ? true : false;
function KeyboardNavigation (settings) {
var root = settings.root;
var focusedElement, focusedControl;
function isElement(node) {
return node && node.nodeType === 1;
focusedElement = domGlobals.document.activeElement;
focusedElement = domGlobals.document.body;
focusedControl = root.getParentCtrl(focusedElement);
elm = elm || focusedElement;
return elm.getAttribute('role');
function getParentRole(elm) {
var role, parent = elm || focusedElement;
while (parent = parent.parentNode) {
if (role = getRole(parent)) {
function getAriaProp(name) {
var elm = focusedElement;
return elm.getAttribute('aria-' + name);
function isTextInputElement(elm) {
var tagName = elm.tagName.toUpperCase();
return tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT';
if (isTextInputElement(elm) && !elm.hidden) {
if (hasTabstopData(elm)) {
if (/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(getRole(elm))) {
function getFocusElements(elm) {
if (elm.nodeType !== 1 || elm.style.display === 'none' || elm.disabled) {
for (var i = 0; i < elm.childNodes.length; i++) {
collect(elm.childNodes[i]);
collect(elm || root.getEl());
function getNavigationRoot(targetControl) {
var navigationRoot, controls;
targetControl = targetControl || focusedControl;
controls = targetControl.parents().toArray();
controls.unshift(targetControl);
for (var i = 0; i < controls.length; i++) {
navigationRoot = controls[i];
if (navigationRoot.settings.ariaRoot) {
function focusFirst(targetControl) {
var navigationRoot = getNavigationRoot(targetControl);
var focusElements = getFocusElements(navigationRoot.getEl());
if (navigationRoot.settings.ariaRemember && 'lastAriaIndex' in navigationRoot) {
moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements);
moveFocusToIndex(0, focusElements);
function moveFocusToIndex(idx, elements) {
idx = elements.length - 1;
} else if (idx >= elements.length) {
function moveFocus(dir, elements) {
var navigationRoot = getNavigationRoot();
elements = elements || getFocusElements(navigationRoot.getEl());
for (var i = 0; i < elements.length; i++) {
if (elements[i] === focusedElement) {
navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements);
var parentRole = getParentRole();
if (parentRole === 'tablist') {
moveFocus(-1, getFocusElements(focusedElement.parentNode));
} else if (focusedControl.parent().submenu) {
var role = getRole(), parentRole = getParentRole();
if (parentRole === 'tablist') {
moveFocus(1, getFocusElements(focusedElement.parentNode));
} else if (role === 'menuitem' && parentRole === 'menu' && getAriaProp('haspopup')) {
var role = getRole(), parentRole = getParentRole();
if (role === 'menuitem' && parentRole === 'menubar') {
} else if (role === 'button' && getAriaProp('haspopup')) {
var parentRole = getParentRole();
if (parentRole === 'tablist') {
var elm = getFocusElements(focusedControl.getEl('body'))[0];
moveFocus(e.shiftKey ? -1 : 1);
focusedControl.fire('cancel');
focusedControl.fire('click', {
root.on('keydown', function (e) {
function handleNonTabOrEscEvent(e, handler) {
if (isTextInputElement(focusedElement) || hasTabstopData(focusedElement)) {
if (getRole(focusedElement) === 'slider') {
if (handler(e) !== false) {
if (e.isDefaultPrevented()) {
handleNonTabOrEscEvent(e, left);
handleNonTabOrEscEvent(e, right);
handleNonTabOrEscEvent(e, up);
handleNonTabOrEscEvent(e, down);
handleNonTabOrEscEvent(e, enter);
root.on('focusin', function (e) {