JR Utily

- renamed lib in resources

- test using passthrough elements
Showing 662 changed files with 0 additions and 5013 deletions
tinymce.PluginManager.add("example_dependency",function(){},["example"]);
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('fullscreen', function(editor) {
var fullscreenState = false, DOM = tinymce.DOM, iframeWidth, iframeHeight, resizeHandler;
var containerWidth, containerHeight, scrollPos;
if (editor.settings.inline) {
return;
}
function getWindowSize() {
var w, h, win = window, doc = document;
var body = doc.body;
// Old IE
if (body.offsetWidth) {
w = body.offsetWidth;
h = body.offsetHeight;
}
// Modern browsers
if (win.innerWidth && win.innerHeight) {
w = win.innerWidth;
h = win.innerHeight;
}
return {w: w, h: h};
}
function getScrollPos() {
var vp = tinymce.DOM.getViewPort();
return {
x: vp.x,
y: vp.y
};
}
function setScrollPos(pos) {
scrollTo(pos.x, pos.y);
}
function toggleFullscreen() {
var body = document.body, documentElement = document.documentElement, editorContainerStyle;
var editorContainer, iframe, iframeStyle;
function resize() {
DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight));
}
fullscreenState = !fullscreenState;
editorContainer = editor.getContainer();
editorContainerStyle = editorContainer.style;
iframe = editor.getContentAreaContainer().firstChild;
iframeStyle = iframe.style;
if (fullscreenState) {
scrollPos = getScrollPos();
iframeWidth = iframeStyle.width;
iframeHeight = iframeStyle.height;
iframeStyle.width = iframeStyle.height = '100%';
containerWidth = editorContainerStyle.width;
containerHeight = editorContainerStyle.height;
editorContainerStyle.width = editorContainerStyle.height = '';
DOM.addClass(body, 'mce-fullscreen');
DOM.addClass(documentElement, 'mce-fullscreen');
DOM.addClass(editorContainer, 'mce-fullscreen');
DOM.bind(window, 'resize', resize);
resize();
resizeHandler = resize;
} else {
iframeStyle.width = iframeWidth;
iframeStyle.height = iframeHeight;
if (containerWidth) {
editorContainerStyle.width = containerWidth;
}
if (containerHeight) {
editorContainerStyle.height = containerHeight;
}
DOM.removeClass(body, 'mce-fullscreen');
DOM.removeClass(documentElement, 'mce-fullscreen');
DOM.removeClass(editorContainer, 'mce-fullscreen');
DOM.unbind(window, 'resize', resizeHandler);
setScrollPos(scrollPos);
}
editor.fire('FullscreenStateChanged', {state: fullscreenState});
}
editor.on('init', function() {
editor.addShortcut('Ctrl+Shift+F', '', toggleFullscreen);
});
editor.on('remove', function() {
if (resizeHandler) {
DOM.unbind(window, 'resize', resizeHandler);
}
});
editor.addCommand('mceFullScreen', toggleFullscreen);
editor.addMenuItem('fullscreen', {
text: 'Fullscreen',
shortcut: 'Ctrl+Shift+F',
selectable: true,
onClick: function() {
toggleFullscreen();
editor.focus();
},
onPostRender: function() {
var self = this;
editor.on('FullscreenStateChanged', function(e) {
self.active(e.state);
});
},
context: 'view'
});
editor.addButton('fullscreen', {
tooltip: 'Fullscreen',
shortcut: 'Ctrl+Shift+F',
onClick: toggleFullscreen,
onPostRender: function() {
var self = this;
editor.on('FullscreenStateChanged', function(e) {
self.active(e.state);
});
}
});
return {
isFullscreen: function() {
return fullscreenState;
}
};
});
tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){var a=tinymce.DOM.getViewPort();return{x:a.x,y:a.y}}function d(a){scrollTo(a.x,a.y)}function e(){function e(){m.setStyle(p,"height",b().h-(o.clientHeight-p.clientHeight))}var n,o,p,q,r=document.body,s=document.documentElement;l=!l,o=a.getContainer(),n=o.style,p=a.getContentAreaContainer().firstChild,q=p.style,l?(k=c(),f=q.width,g=q.height,q.width=q.height="100%",i=n.width,j=n.height,n.width=n.height="",m.addClass(r,"mce-fullscreen"),m.addClass(s,"mce-fullscreen"),m.addClass(o,"mce-fullscreen"),m.bind(window,"resize",e),e(),h=e):(q.width=f,q.height=g,i&&(n.width=i),j&&(n.height=j),m.removeClass(r,"mce-fullscreen"),m.removeClass(s,"mce-fullscreen"),m.removeClass(o,"mce-fullscreen"),m.unbind(window,"resize",h),d(k)),a.fire("FullscreenStateChanged",{state:l})}var f,g,h,i,j,k,l=!1,m=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Ctrl+Shift+F","",e)}),a.on("remove",function(){h&&m.unbind(window,"resize",h)}),a.addCommand("mceFullScreen",e),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,onClick:function(){e(),a.focus()},onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Shift+F",onClick:e,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return l}})});
\ No newline at end of file
configure({
configs: [
'./test.js',
'./prod.js'
]
});
/**
* Demo.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*eslint no-console:0 */
define("tinymce/imagetoolsplugin/Demo", [
"tinymce/imagetoolsplugin/Plugin",
"global!tinymce",
"global!tinymce.dom.DomQuery",
"global!console"
], function(Plugin, tinymce, $, console) {
return function() {
var imgSrc = '../../../../../../../tests/manual/img/dogleft.jpg';
$(
'<textarea class="tinymce">' +
'<p>' +
'<img src="' + imgSrc + '" width="160" height="100">' +
'<img src="' + imgSrc + '" style="width: 160px; height: 100px">' +
'<img src="' + imgSrc + '" style="width: 20%">' +
'<img src="' + imgSrc + '">' +
'<img src="http://moxiecode.cachefly.net/tinymce/v9/images/logo.png">' +
'</p>' +
'</textarea>'
).appendTo('#ephox-ui');
tinymce.init({
//imagetools_cors_hosts: ["moxiecode.cachefly.net"],
//imagetools_proxy: "proxy.php",
//imagetools_api_key: '123',
//images_upload_url: 'postAcceptor.php',
//images_upload_base_path: 'base/path',
//images_upload_credentials: true,
selector: "textarea.tinymce",
theme: "modern",
plugins: [
"imagetools paste"
],
add_unload_trigger: false,
//images_replace_blob_uris: false,
paste_data_images: true,
image_caption: true,
height: 600,
toolbar1: "undo redo | styleselect | alignleft aligncenter alignright alignjustify | link image | media | emoticons",
images_upload_handler: function(data, success, failure, progress) {
console.log('blob upload [started]', data.id());
progress(0);
setTimeout(function() {
console.log('blob upload [ended]', data.id());
success(data.id() + '.png');
progress(100);
}, 1000);
}
});
function send() {
tinymce.activeEditor.uploadImages(function() {
console.log('saving:', tinymce.activeEditor.getContent());
});
}
function upload() {
console.log('upload [started]');
tinymce.activeEditor.uploadImages(function(success) {
console.log('upload [ended]', success);
});
}
function dump() {
var content = tinymce.activeEditor.getContent();
$('#view').html(content);
console.log(content);
}
$('<button>send()</button>').appendTo('#ephox-ui').on('click', send);
$('<button>upload()</button>').appendTo('#ephox-ui').on('click', upload);
$('<button>dump()</button>').appendTo('#ephox-ui').on('click', dump);
};
});
/**
* ImagePanel.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* ...
*
* @-x-less ImagePanel.less
*/
define("tinymce/imagetoolsplugin/ImagePanel", [
"global!tinymce.ui.Control",
"global!tinymce.ui.DragHelper",
"global!tinymce.geom.Rect",
"global!tinymce.util.Tools",
"global!tinymce.util.Promise",
"tinymce/imagetoolsplugin/CropRect"
], function(Control, DragHelper, Rect, Tools, Promise, CropRect) {
function loadImage(image) {
return new Promise(function(resolve) {
function loaded() {
image.removeEventListener('load', loaded);
resolve(image);
}
if (image.complete) {
resolve(image);
} else {
image.addEventListener('load', loaded);
}
});
}
return Control.extend({
Defaults: {
classes: "imagepanel"
},
selection: function(rect) {
if (arguments.length) {
this.state.set('rect', rect);
return this;
}
return this.state.get('rect');
},
imageSize: function() {
var viewRect = this.state.get('viewRect');
return {
w: viewRect.w,
h: viewRect.h
};
},
toggleCropRect: function(state) {
this.state.set('cropEnabled', state);
},
imageSrc: function(url) {
var self = this, img = new Image();
img.src = url;
loadImage(img).then(function() {
var rect, $img, lastRect = self.state.get('viewRect');
$img = self.$el.find('img');
if ($img[0]) {
$img.replaceWith(img);
} else {
self.getEl().appendChild(img);
}
rect = {x: 0, y: 0, w: img.naturalWidth, h: img.naturalHeight};
self.state.set('viewRect', rect);
self.state.set('rect', Rect.inflate(rect, -20, -20));
if (!lastRect || lastRect.w != rect.w || lastRect.h != rect.h) {
self.zoomFit();
}
self.repaintImage();
self.fire('load');
});
},
zoom: function(value) {
if (arguments.length) {
this.state.set('zoom', value);
return this;
}
return this.state.get('zoom');
},
postRender: function() {
this.imageSrc(this.settings.imageSrc);
return this._super();
},
zoomFit: function() {
var self = this, $img, pw, ph, w, h, zoom, padding;
padding = 10;
$img = self.$el.find('img');
pw = self.getEl().clientWidth;
ph = self.getEl().clientHeight;
w = $img[0].naturalWidth;
h = $img[0].naturalHeight;
zoom = Math.min((pw - padding) / w, (ph - padding) / h);
if (zoom >= 1) {
zoom = 1;
}
self.zoom(zoom);
},
repaintImage: function() {
var x, y, w, h, pw, ph, $img, zoom, rect, elm;
elm = this.getEl();
zoom = this.zoom();
rect = this.state.get('rect');
$img = this.$el.find('img');
pw = elm.offsetWidth;
ph = elm.offsetHeight;
w = $img[0].naturalWidth * zoom;
h = $img[0].naturalHeight * zoom;
x = Math.max(0, pw / 2 - w / 2);
y = Math.max(0, ph / 2 - h / 2);
$img.css({
left: x,
top: y,
width: w,
height: h
});
if (this.cropRect) {
this.cropRect.setRect({
x: rect.x * zoom + x,
y: rect.y * zoom + y,
w: rect.w * zoom,
h: rect.h * zoom
});
this.cropRect.setClampRect({
x: x,
y: y,
w: w,
h: h
});
this.cropRect.setViewPortRect({
x: 0,
y: 0,
w: pw,
h: ph
});
}
},
bindStates: function() {
var self = this;
function setupCropRect(rect) {
self.cropRect = new CropRect(
rect,
self.state.get('viewRect'),
self.state.get('viewRect'),
self.getEl(),
function() {
self.fire('crop');
}
);
self.cropRect.on('updateRect', function(e) {
var rect = e.rect, zoom = self.zoom();
rect = {
x: Math.round(rect.x / zoom),
y: Math.round(rect.y / zoom),
w: Math.round(rect.w / zoom),
h: Math.round(rect.h / zoom)
};
self.state.set('rect', rect);
});
self.on('remove', self.cropRect.destroy);
}
self.state.on('change:cropEnabled', function(e) {
self.cropRect.toggleVisibility(e.value);
self.repaintImage();
});
self.state.on('change:zoom', function() {
self.repaintImage();
});
self.state.on('change:rect', function(e) {
var rect = e.value;
if (!self.cropRect) {
setupCropRect(rect);
}
self.cropRect.setRect(rect);
});
}
});
});
/**
* ImageSize.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define("tinymce/imagetoolsplugin/ImageSize", [
], function() {
function getImageSize(img) {
var width, height;
function isPxValue(value) {
return /^[0-9\.]+px$/.test(value);
}
width = img.style.width;
height = img.style.height;
if (width || height) {
if (isPxValue(width) && isPxValue(height)) {
return {
w: parseInt(width, 10),
h: parseInt(height, 10)
};
}
return null;
}
width = img.width;
height = img.height;
if (width && height) {
return {
w: parseInt(width, 10),
h: parseInt(height, 10)
};
}
return null;
}
function setImageSize(img, size) {
var width, height;
if (size) {
width = img.style.width;
height = img.style.height;
if (width || height) {
img.style.width = size.w + 'px';
img.style.height = size.h + 'px';
img.removeAttribute('data-mce-style');
}
width = img.width;
height = img.height;
if (width || height) {
img.setAttribute('width', size.w);
img.setAttribute('height', size.h);
}
}
}
function getNaturalImageSize(img) {
return {
w: img.naturalWidth,
h: img.naturalHeight
};
}
return {
getImageSize: getImageSize,
setImageSize: setImageSize,
getNaturalImageSize: getNaturalImageSize
};
});
/**
* Plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
*
* Settings:
* imagetools_cors_hosts - Array of remote domains that has CORS setup.
* imagetools_proxy - Url to proxy that streams images from remote host to local host.
* imagetools_toolbar - Toolbar items to render when an editable image is selected.
*/
define("tinymce/imagetoolsplugin/Plugin", [
"global!tinymce.PluginManager",
"global!tinymce.Env",
"global!tinymce.util.Promise",
"global!tinymce.util.URI",
"global!tinymce.util.Tools",
"global!tinymce.util.Delay",
"ephox/imagetools/api/ImageTransformations",
"ephox/imagetools/api/BlobConversions",
"tinymce/imagetoolsplugin/Dialog",
"tinymce/imagetoolsplugin/ImageSize",
"tinymce/imagetoolsplugin/Proxy"
], function(PluginManager, Env, Promise, URI, Tools, Delay, ImageTransformations, BlobConversions, Dialog, ImageSize, Proxy) {
var plugin = function(editor) {
var count = 0, imageUploadTimer, lastSelectedImage;
if (!Env.fileApi) {
return;
}
function displayError(error) {
editor.notificationManager.open({
text: error,
type: 'error'
});
}
function getSelectedImage() {
return editor.selection.getNode();
}
function createId() {
return 'imagetools' + count++;
}
function isLocalImage(img) {
var url = img.src;
return url.indexOf('data:') === 0 || url.indexOf('blob:') === 0 || new URI(url).host === editor.documentBaseURI.host;
}
function isCorsImage(img) {
return Tools.inArray(editor.settings.imagetools_cors_hosts, new URI(img.src).host) !== -1;
}
function getApiKey() {
return editor.settings.api_key || editor.settings.imagetools_api_key;
}
function imageToBlob(img) {
var src = img.src, apiKey;
if (isCorsImage(img)) {
return Proxy.getUrl(img.src, null);
}
if (!isLocalImage(img)) {
src = editor.settings.imagetools_proxy;
src += (src.indexOf('?') === -1 ? '?' : '&') + 'url=' + encodeURIComponent(img.src);
apiKey = getApiKey();
return Proxy.getUrl(src, apiKey);
}
return BlobConversions.imageToBlob(img);
}
function findSelectedBlob() {
var blobInfo;
blobInfo = editor.editorUpload.blobCache.getByUri(getSelectedImage().src);
if (blobInfo) {
return blobInfo.blob();
}
return imageToBlob(getSelectedImage());
}
function startTimedUpload() {
imageUploadTimer = Delay.setEditorTimeout(editor, function() {
editor.editorUpload.uploadImagesAuto();
}, 30000);
}
function cancelTimedUpload() {
clearTimeout(imageUploadTimer);
}
function updateSelectedImage(blob, uploadImmediately) {
return BlobConversions.blobToDataUri(blob).then(function(dataUri) {
var id, base64, blobCache, blobInfo, selectedImage;
selectedImage = getSelectedImage();
id = createId();
blobCache = editor.editorUpload.blobCache;
base64 = URI.parseDataUri(dataUri).data;
blobInfo = blobCache.create(id, blob, base64);
blobCache.add(blobInfo);
editor.undoManager.transact(function() {
function imageLoadedHandler() {
editor.$(selectedImage).off('load', imageLoadedHandler);
editor.nodeChanged();
if (uploadImmediately) {
editor.editorUpload.uploadImagesAuto();
} else {
cancelTimedUpload();
startTimedUpload();
}
}
editor.$(selectedImage).on('load', imageLoadedHandler);
editor.$(selectedImage).attr({
src: blobInfo.blobUri()
}).removeAttr('data-mce-src');
});
return blobInfo;
});
}
function selectedImageOperation(fn) {
return function() {
return editor._scanForImages().then(findSelectedBlob).then(fn).then(updateSelectedImage, displayError);
};
}
function rotate(angle) {
return function() {
return selectedImageOperation(function(blob) {
var size = ImageSize.getImageSize(getSelectedImage());
if (size) {
ImageSize.setImageSize(getSelectedImage(), {
w: size.h,
h: size.w
});
}
return ImageTransformations.rotate(blob, angle);
})();
};
}
function flip(axis) {
return function() {
return selectedImageOperation(function(blob) {
return ImageTransformations.flip(blob, axis);
})();
};
}
function editImageDialog() {
var img = getSelectedImage(), originalSize = ImageSize.getNaturalImageSize(img);
var handleDialogBlob = function(blob) {
return new Promise(function(resolve) {
BlobConversions.blobToImage(blob).then(function(newImage) {
var newSize = ImageSize.getNaturalImageSize(newImage);
if (originalSize.w != newSize.w || originalSize.h != newSize.h) {
if (ImageSize.getImageSize(img)) {
ImageSize.setImageSize(img, newSize);
}
}
URL.revokeObjectURL(newImage.src);
resolve(blob);
});
});
};
var openDialog = function (blob) {
return Dialog.edit(blob).then(handleDialogBlob).then(function(blob) {
updateSelectedImage(blob, true);
}, function () {
// Close dialog
});
};
if (img) {
imageToBlob(img).then(openDialog, displayError);
}
}
function addButtons() {
editor.addButton('rotateleft', {
title: 'Rotate counterclockwise',
onclick: rotate(-90)
});
editor.addButton('rotateright', {
title: 'Rotate clockwise',
onclick: rotate(90)
});
editor.addButton('flipv', {
title: 'Flip vertically',
onclick: flip('v')
});
editor.addButton('fliph', {
title: 'Flip horizontally',
onclick: flip('h')
});
editor.addButton('editimage', {
title: 'Edit image',
onclick: editImageDialog
});
editor.addButton('imageoptions', {
title: 'Image options',
icon: 'options',
cmd: 'mceImage'
});
/*
editor.addButton('crop', {
title: 'Crop',
onclick: startCrop
});
*/
}
function addEvents() {
editor.on('NodeChange', function(e) {
//If the last node we selected was an image
//And had a source that doesn't match the current blob url
//We need to attempt to upload it
if (lastSelectedImage && lastSelectedImage.src != e.element.src) {
cancelTimedUpload();
editor.editorUpload.uploadImagesAuto();
lastSelectedImage = undefined;
}
//Set up the lastSelectedImage
if (isEditableImage(e.element)) {
lastSelectedImage = e.element;
}
});
}
function isEditableImage(img) {
var selectorMatched = editor.dom.is(img, 'img:not([data-mce-object],[data-mce-placeholder])');
return selectorMatched && (isLocalImage(img) || isCorsImage(img) || editor.settings.imagetools_proxy);
}
function addToolbars() {
var toolbarItems = editor.settings.imagetools_toolbar;
if (!toolbarItems) {
toolbarItems = 'rotateleft rotateright | flipv fliph | crop editimage imageoptions';
}
editor.addContextToolbar(
isEditableImage,
toolbarItems
);
}
addButtons();
addToolbars();
addEvents();
editor.addCommand('mceEditImage', editImageDialog);
};
PluginManager.add('imagetools', plugin);
return function() {};
});
/**
* Proxy.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* Handles loading images though a proxy for working around cors.
*/
define("tinymce/imagetoolsplugin/Proxy", [
"global!tinymce.util.Promise",
"global!tinymce.util.Tools",
"tinymce/imagetoolsplugin/Utils"
], function(Promise, Tools, Utils) {
var isServiceErrorCode = function (code) {
return code === 400 || code === 403 || code === 500;
};
var handleHttpError = function (status) {
return Promise.reject("ImageProxy HTTP error: " + status);
};
var proxyServiceError = function (error) {
Promise.reject("ImageProxy Service error: " + error);
};
var handleServiceError = function (status, blob) {
return Utils.readBlob(blob).then(function(text) {
var serviceError = Utils.parseJson(text);
var errorType = Utils.traverse(serviceError, ['error', 'type']);
return errorType ? proxyServiceError(errorType) : proxyServiceError('Invalid JSON');
});
};
var handleServiceErrorResponse = function (status, blob) {
return isServiceErrorCode(status) ? handleServiceError(status, blob) : handleHttpError(status);
};
var requestServiceBlob = function (url, apiKey) {
return Utils.requestUrlAsBlob(url, {
'Content-Type': 'application/json;charset=UTF-8',
'tiny-api-key': apiKey
}).then(function (result) {
return result.status >= 400 ? handleServiceErrorResponse(result.status, result.blob) : Promise.resolve(result.blob);
});
};
function requestBlob(url) {
return Utils.requestUrlAsBlob(url, {}).then(function (result) {
return result.status >= 400 ? handleHttpError(result.status) : Promise.resolve(result.blob);
});
}
var getUrl = function (url, apiKey) {
return apiKey ? requestServiceBlob(url, apiKey) : requestBlob(url);
};
return {
getUrl: getUrl
};
});
/**
* Utils.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define("tinymce/imagetoolsplugin/Utils", [
"global!tinymce.util.Promise",
"global!tinymce.util.Tools"
], function(Promise, Tools) {
var isValue = function (obj) {
return obj !== null && obj !== undefined;
};
var traverse = function (json, path) {
var value;
value = path.reduce(function(result, key) {
return isValue(result) ? result[key] : undefined;
}, json);
return isValue(value) ? value : null;
};
var requestUrlAsBlob = function (url, headers) {
return new Promise(function(resolve) {
var xhr;
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
resolve({
status: xhr.status,
blob: this.response
});
}
};
xhr.open('GET', url, true);
Tools.each(headers, function (value, key) {
xhr.setRequestHeader(key, value);
});
xhr.responseType = 'blob';
xhr.send();
});
};
var readBlob = function (blob) {
return new Promise(function(resolve) {
var fr = new FileReader();
fr.onload = function (e) {
var data = e.target;
resolve(data.result);
};
fr.readAsText(blob);
});
};
var parseJson = function (text) {
var json;
try {
json = JSON.parse(text);
} catch (ex) {
// Ignore
}
return json;
};
return {
traverse: traverse,
readBlob: readBlob,
requestUrlAsBlob: requestUrlAsBlob,
parseJson: parseJson
};
});
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('importcss', function(editor) {
var self = this, each = tinymce.each;
function removeCacheSuffix(url) {
var cacheSuffix = tinymce.Env.cacheSuffix;
if (typeof url == 'string') {
url = url.replace('?' + cacheSuffix, '').replace('&' + cacheSuffix, '');
}
return url;
}
function isSkinContentCss(href) {
var settings = editor.settings, skin = settings.skin !== false ? settings.skin || 'lightgray' : false;
if (skin) {
var skinUrl = settings.skin_url;
if (skinUrl) {
skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);
} else {
skinUrl = tinymce.baseURL + '/skins/' + skin;
}
return href === skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css';
}
return false;
}
function compileFilter(filter) {
if (typeof filter == "string") {
return function(value) {
return value.indexOf(filter) !== -1;
};
} else if (filter instanceof RegExp) {
return function(value) {
return filter.test(value);
};
}
return filter;
}
function getSelectors(doc, fileFilter) {
var selectors = [], contentCSSUrls = {};
function append(styleSheet, imported) {
var href = styleSheet.href, rules;
href = removeCacheSuffix(href);
if (!href || !fileFilter(href, imported) || isSkinContentCss(href)) {
return;
}
each(styleSheet.imports, function(styleSheet) {
append(styleSheet, true);
});
try {
rules = styleSheet.cssRules || styleSheet.rules;
} catch (e) {
// Firefox fails on rules to remote domain for example:
// @import url(//fonts.googleapis.com/css?family=Pathway+Gothic+One);
}
each(rules, function(cssRule) {
if (cssRule.styleSheet) {
append(cssRule.styleSheet, true);
} else if (cssRule.selectorText) {
each(cssRule.selectorText.split(','), function(selector) {
selectors.push(tinymce.trim(selector));
});
}
});
}
each(editor.contentCSS, function(url) {
contentCSSUrls[url] = true;
});
if (!fileFilter) {
fileFilter = function(href, imported) {
return imported || contentCSSUrls[href];
};
}
try {
each(doc.styleSheets, function(styleSheet) {
append(styleSheet);
});
} catch (e) {
// Ignore
}
return selectors;
}
function defaultConvertSelectorToFormat(selectorText) {
var format;
// Parse simple element.class1, .class1
var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
if (!selector) {
return;
}
var elementName = selector[1];
var classes = selector[2].substr(1).split('.').join(' ');
var inlineSelectorElements = tinymce.makeMap('a,img');
// element.class - Produce block formats
if (selector[1]) {
format = {
title: selectorText
};
if (editor.schema.getTextBlockElements()[elementName]) {
// Text block format ex: h1.class1
format.block = elementName;
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
// Block elements such as table.class and special inline elements such as a.class or img.class
format.selector = elementName;
} else {
// Inline format strong.class1
format.inline = elementName;
}
} else if (selector[2]) {
// .class - Produce inline span with classes
format = {
inline: 'span',
title: selectorText.substr(1),
classes: classes
};
}
// Append to or override class attribute
if (editor.settings.importcss_merge_classes !== false) {
format.classes = classes;
} else {
format.attributes = {"class": classes};
}
return format;
}
function getGroupsBySelector(groups, selector) {
return tinymce.util.Tools.grep(groups, function (group) {
return !group.filter || group.filter(selector);
});
}
function compileUserDefinedGroups(groups) {
return tinymce.util.Tools.map(groups, function(group) {
return tinymce.util.Tools.extend({}, group, {
original: group,
selectors: {},
filter: compileFilter(group.filter),
item: {
text: group.title,
menu: []
}
});
});
}
function isExclusiveMode(editor, group) {
// Exclusive mode can only be disabled when there are groups allowing the same style to be present in multiple groups
return group === null || editor.settings.importcss_exclusive !== false;
}
function isUniqueSelector(selector, group, globallyUniqueSelectors) {
return !(isExclusiveMode(editor, group) ? selector in globallyUniqueSelectors : selector in group.selectors);
}
function markUniqueSelector(selector, group, globallyUniqueSelectors) {
if (isExclusiveMode(editor, group)) {
globallyUniqueSelectors[selector] = true;
} else {
group.selectors[selector] = true;
}
}
function convertSelectorToFormat(plugin, selector, group) {
var selectorConverter, settings = editor.settings;
if (group && group.selector_converter) {
selectorConverter = group.selector_converter;
} else if (settings.importcss_selector_converter) {
selectorConverter = settings.importcss_selector_converter;
} else {
selectorConverter = defaultConvertSelectorToFormat;
}
return selectorConverter.call(plugin, selector, group);
}
editor.on('renderFormatsMenu', function(e) {
var settings = editor.settings, globallyUniqueSelectors = {};
var selectorFilter = compileFilter(settings.importcss_selector_filter), ctrl = e.control;
var groups = compileUserDefinedGroups(settings.importcss_groups);
var processSelector = function (selector, group) {
if (isUniqueSelector(selector, group, globallyUniqueSelectors)) {
markUniqueSelector(selector, group, globallyUniqueSelectors);
var format = convertSelectorToFormat(self, selector, group);
if (format) {
var formatName = format.name || tinymce.DOM.uniqueId();
editor.formatter.register(formatName, format);
return tinymce.extend({}, ctrl.settings.itemDefaults, {
text: format.title,
format: formatName
});
}
}
return null;
};
if (!editor.settings.importcss_append) {
ctrl.items().remove();
}
each(getSelectors(e.doc || editor.getDoc(), compileFilter(settings.importcss_file_filter)), function(selector) {
if (selector.indexOf('.mce-') === -1) {
if (!selectorFilter || selectorFilter(selector)) {
var selectorGroups = getGroupsBySelector(groups, selector);
if (selectorGroups.length > 0) {
tinymce.util.Tools.each(selectorGroups, function (group) {
var menuItem = processSelector(selector, group);
if (menuItem) {
group.item.menu.push(menuItem);
}
});
} else {
var menuItem = processSelector(selector, null);
if (menuItem) {
ctrl.add(menuItem);
}
}
}
}
});
each(groups, function(group) {
if (group.item.menu.length > 0) {
ctrl.add(group.item);
}
});
e.control.renderNew();
});
// Expose default convertSelectorToFormat implementation
self.convertSelectorToFormat = defaultConvertSelectorToFormat;
});
tinymce.PluginManager.add("importcss",function(a){function b(a){var b=tinymce.Env.cacheSuffix;return"string"==typeof a&&(a=a.replace("?"+b,"").replace("&"+b,"")),a}function c(b){var c=a.settings,d=c.skin!==!1?c.skin||"lightgray":!1;if(d){var e=c.skin_url;return e=e?a.documentBaseURI.toAbsolute(e):tinymce.baseURL+"/skins/"+d,b===e+"/content"+(a.inline?".inline":"")+".min.css"}return!1}function d(a){return"string"==typeof a?function(b){return-1!==b.indexOf(a)}:a instanceof RegExp?function(b){return a.test(b)}:a}function e(d,e){function f(a,d){var h,i=a.href;if(i=b(i),i&&e(i,d)&&!c(i)){n(a.imports,function(a){f(a,!0)});try{h=a.cssRules||a.rules}catch(j){}n(h,function(a){a.styleSheet?f(a.styleSheet,!0):a.selectorText&&n(a.selectorText.split(","),function(a){g.push(tinymce.trim(a))})})}}var g=[],h={};n(a.contentCSS,function(a){h[a]=!0}),e||(e=function(a,b){return b||h[a]});try{n(d.styleSheets,function(a){f(a)})}catch(i){}return g}function f(b){var c,d=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(b);if(d){var e=d[1],f=d[2].substr(1).split(".").join(" "),g=tinymce.makeMap("a,img");return d[1]?(c={title:b},a.schema.getTextBlockElements()[e]?c.block=e:a.schema.getBlockElements()[e]||g[e.toLowerCase()]?c.selector=e:c.inline=e):d[2]&&(c={inline:"span",title:b.substr(1),classes:f}),a.settings.importcss_merge_classes!==!1?c.classes=f:c.attributes={"class":f},c}}function g(a,b){return tinymce.util.Tools.grep(a,function(a){return!a.filter||a.filter(b)})}function h(a){return tinymce.util.Tools.map(a,function(a){return tinymce.util.Tools.extend({},a,{original:a,selectors:{},filter:d(a.filter),item:{text:a.title,menu:[]}})})}function i(a,b){return null===b||a.settings.importcss_exclusive!==!1}function j(b,c,d){return!(i(a,c)?b in d:b in c.selectors)}function k(b,c,d){i(a,c)?d[b]=!0:c.selectors[b]=!0}function l(b,c,d){var e,g=a.settings;return e=d&&d.selector_converter?d.selector_converter:g.importcss_selector_converter?g.importcss_selector_converter:f,e.call(b,c,d)}var m=this,n=tinymce.each;a.on("renderFormatsMenu",function(b){var c=a.settings,f={},i=d(c.importcss_selector_filter),o=b.control,p=h(c.importcss_groups),q=function(b,c){if(j(b,c,f)){k(b,c,f);var d=l(m,b,c);if(d){var e=d.name||tinymce.DOM.uniqueId();return a.formatter.register(e,d),tinymce.extend({},o.settings.itemDefaults,{text:d.title,format:e})}}return null};a.settings.importcss_append||o.items().remove(),n(e(b.doc||a.getDoc(),d(c.importcss_file_filter)),function(a){if(-1===a.indexOf(".mce-")&&(!i||i(a))){var b=g(p,a);if(b.length>0)tinymce.util.Tools.each(b,function(b){var c=q(a,b);c&&b.item.menu.push(c)});else{var c=q(a,null);c&&o.add(c)}}}),n(p,function(a){a.item.menu.length>0&&o.add(a.item)}),b.control.renderNew()}),m.convertSelectorToFormat=f});
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('insertdatetime', function(editor) {
var daysShort = "Sun Mon Tue Wed Thu Fri Sat Sun".split(' ');
var daysLong = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(' ');
var monthsShort = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(' ');
var monthsLong = "January February March April May June July August September October November December".split(' ');
var menuItems = [], lastFormat, defaultButtonTimeFormat;
function getDateTime(fmt, date) {
function addZeros(value, len) {
value = "" + value;
if (value.length < len) {
for (var i = 0; i < (len - value.length); i++) {
value = "0" + value;
}
}
return value;
}
date = date || new Date();
fmt = fmt.replace("%D", "%m/%d/%Y");
fmt = fmt.replace("%r", "%I:%M:%S %p");
fmt = fmt.replace("%Y", "" + date.getFullYear());
fmt = fmt.replace("%y", "" + date.getYear());
fmt = fmt.replace("%m", addZeros(date.getMonth() + 1, 2));
fmt = fmt.replace("%d", addZeros(date.getDate(), 2));
fmt = fmt.replace("%H", "" + addZeros(date.getHours(), 2));
fmt = fmt.replace("%M", "" + addZeros(date.getMinutes(), 2));
fmt = fmt.replace("%S", "" + addZeros(date.getSeconds(), 2));
fmt = fmt.replace("%I", "" + ((date.getHours() + 11) % 12 + 1));
fmt = fmt.replace("%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
fmt = fmt.replace("%B", "" + editor.translate(monthsLong[date.getMonth()]));
fmt = fmt.replace("%b", "" + editor.translate(monthsShort[date.getMonth()]));
fmt = fmt.replace("%A", "" + editor.translate(daysLong[date.getDay()]));
fmt = fmt.replace("%a", "" + editor.translate(daysShort[date.getDay()]));
fmt = fmt.replace("%%", "%");
return fmt;
}
function insertDateTime(format) {
var html = getDateTime(format);
if (editor.settings.insertdatetime_element) {
var computerTime;
if (/%[HMSIp]/.test(format)) {
computerTime = getDateTime("%Y-%m-%dT%H:%M");
} else {
computerTime = getDateTime("%Y-%m-%d");
}
html = '<time datetime="' + computerTime + '">' + html + '</time>';
var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
if (timeElm) {
editor.dom.setOuterHTML(timeElm, html);
return;
}
}
editor.insertContent(html);
}
editor.addCommand('mceInsertDate', function() {
insertDateTime(editor.getParam("insertdatetime_dateformat", editor.translate("%Y-%m-%d")));
});
editor.addCommand('mceInsertTime', function() {
insertDateTime(editor.getParam("insertdatetime_timeformat", editor.translate('%H:%M:%S')));
});
editor.addButton('insertdatetime', {
type: 'splitbutton',
title: 'Insert date/time',
onclick: function() {
insertDateTime(lastFormat || defaultButtonTimeFormat);
},
menu: menuItems
});
tinymce.each(editor.settings.insertdatetime_formats || [
"%H:%M:%S",
"%Y-%m-%d",
"%I:%M:%S %p",
"%D"
], function(fmt) {
if (!defaultButtonTimeFormat) {
defaultButtonTimeFormat = fmt;
}
menuItems.push({
text: getDateTime(fmt),
onclick: function() {
lastFormat = fmt;
insertDateTime(fmt);
}
});
});
editor.addMenuItem('insertdatetime', {
icon: 'date',
text: 'Insert date/time',
menu: menuItems,
context: 'insert'
});
});
tinymce.PluginManager.add("insertdatetime",function(a){function b(b,c){function d(a,b){if(a=""+a,a.length<b)for(var c=0;c<b-a.length;c++)a="0"+a;return a}return c=c||new Date,b=b.replace("%D","%m/%d/%Y"),b=b.replace("%r","%I:%M:%S %p"),b=b.replace("%Y",""+c.getFullYear()),b=b.replace("%y",""+c.getYear()),b=b.replace("%m",d(c.getMonth()+1,2)),b=b.replace("%d",d(c.getDate(),2)),b=b.replace("%H",""+d(c.getHours(),2)),b=b.replace("%M",""+d(c.getMinutes(),2)),b=b.replace("%S",""+d(c.getSeconds(),2)),b=b.replace("%I",""+((c.getHours()+11)%12+1)),b=b.replace("%p",""+(c.getHours()<12?"AM":"PM")),b=b.replace("%B",""+a.translate(i[c.getMonth()])),b=b.replace("%b",""+a.translate(h[c.getMonth()])),b=b.replace("%A",""+a.translate(g[c.getDay()])),b=b.replace("%a",""+a.translate(f[c.getDay()])),b=b.replace("%%","%")}function c(c){var d=b(c);if(a.settings.insertdatetime_element){var e;e=b(/%[HMSIp]/.test(c)?"%Y-%m-%dT%H:%M":"%Y-%m-%d"),d='<time datetime="'+e+'">'+d+"</time>";var f=a.dom.getParent(a.selection.getStart(),"time");if(f)return void a.dom.setOuterHTML(f,d)}a.insertContent(d)}var d,e,f="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),g="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),h="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),i="January February March April May June July August September October November December".split(" "),j=[];a.addCommand("mceInsertDate",function(){c(a.getParam("insertdatetime_dateformat",a.translate("%Y-%m-%d")))}),a.addCommand("mceInsertTime",function(){c(a.getParam("insertdatetime_timeformat",a.translate("%H:%M:%S")))}),a.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",onclick:function(){c(d||e)},menu:j}),tinymce.each(a.settings.insertdatetime_formats||["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"],function(a){e||(e=a),j.push({text:b(a),onclick:function(){d=a,c(a)}})}),a.addMenuItem("insertdatetime",{icon:"date",text:"Insert date/time",menu:j,context:"insert"})});
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('layer', function(editor) {
function getParentLayer(node) {
do {
if (node.className && node.className.indexOf('mceItemLayer') != -1) {
return node;
}
} while ((node = node.parentNode));
}
function visualAid(e) {
var dom = editor.dom;
tinymce.each(dom.select('div,p', e), function(e) {
if (/^(absolute|relative|fixed)$/i.test(e.style.position)) {
if (e.hasVisual) {
dom.addClass(e, 'mceItemVisualAid');
} else {
dom.removeClass(e, 'mceItemVisualAid');
}
dom.addClass(e, 'mceItemLayer');
}
});
}
function move(d) {
var i, z = [], le = getParentLayer(editor.selection.getNode()), ci = -1, fi = -1, nl;
nl = [];
tinymce.walk(editor.getBody(), function(n) {
if (n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position)) {
nl.push(n);
}
}, 'childNodes');
// Find z-indexes
for (i = 0; i < nl.length; i++) {
z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex, 10) : 0;
if (ci < 0 && nl[i] == le) {
ci = i;
}
}
if (d < 0) {
// Move back
// Try find a lower one
for (i = 0; i < z.length; i++) {
if (z[i] < z[ci]) {
fi = i;
break;
}
}
if (fi > -1) {
nl[ci].style.zIndex = z[fi];
nl[fi].style.zIndex = z[ci];
} else {
if (z[ci] > 0) {
nl[ci].style.zIndex = z[ci] - 1;
}
}
} else {
// Move forward
// Try find a higher one
for (i = 0; i < z.length; i++) {
if (z[i] > z[ci]) {
fi = i;
break;
}
}
if (fi > -1) {
nl[ci].style.zIndex = z[fi];
nl[fi].style.zIndex = z[ci];
} else {
nl[ci].style.zIndex = z[ci] + 1;
}
}
editor.execCommand('mceRepaint');
}
function insertLayer() {
var dom = editor.dom, p = dom.getPos(dom.getParent(editor.selection.getNode(), '*'));
var body = editor.getBody();
editor.dom.add(body, 'div', {
style: {
position: 'absolute',
left: p.x,
top: (p.y > 20 ? p.y : 20),
width: 100,
height: 100
},
'class': 'mceItemVisualAid mceItemLayer'
}, editor.selection.getContent() || editor.getLang('layer.content'));
// Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7
if (tinymce.Env.ie) {
dom.setHTML(body, body.innerHTML);
}
}
function toggleAbsolute() {
var le = getParentLayer(editor.selection.getNode());
if (!le) {
le = editor.dom.getParent(editor.selection.getNode(), 'DIV,P,IMG');
}
if (le) {
if (le.style.position.toLowerCase() == "absolute") {
editor.dom.setStyles(le, {
position: '',
left: '',
top: '',
width: '',
height: ''
});
editor.dom.removeClass(le, 'mceItemVisualAid');
editor.dom.removeClass(le, 'mceItemLayer');
} else {
if (!le.style.left) {
le.style.left = 20 + 'px';
}
if (!le.style.top) {
le.style.top = 20 + 'px';
}
if (!le.style.width) {
le.style.width = le.width ? (le.width + 'px') : '100px';
}
if (!le.style.height) {
le.style.height = le.height ? (le.height + 'px') : '100px';
}
le.style.position = "absolute";
editor.dom.setAttrib(le, 'data-mce-style', '');
editor.addVisual(editor.getBody());
}
editor.execCommand('mceRepaint');
editor.nodeChanged();
}
}
// Register commands
editor.addCommand('mceInsertLayer', insertLayer);
editor.addCommand('mceMoveForward', function() {
move(1);
});
editor.addCommand('mceMoveBackward', function() {
move(-1);
});
editor.addCommand('mceMakeAbsolute', function() {
toggleAbsolute();
});
// Register buttons
editor.addButton('moveforward', {title: 'layer.forward_desc', cmd: 'mceMoveForward'});
editor.addButton('movebackward', {title: 'layer.backward_desc', cmd: 'mceMoveBackward'});
editor.addButton('absolute', {title: 'layer.absolute_desc', cmd: 'mceMakeAbsolute'});
editor.addButton('insertlayer', {title: 'layer.insertlayer_desc', cmd: 'mceInsertLayer'});
editor.on('init', function() {
if (tinymce.Env.ie) {
editor.getDoc().execCommand('2D-Position', false, true);
}
});
// Remove serialized styles when selecting a layer since it might be changed by a drag operation
editor.on('mouseup', function(e) {
var layer = getParentLayer(e.target);
if (layer) {
editor.dom.setAttrib(layer, 'data-mce-style', '');
}
});
// Fixes edit focus issues with layers on Gecko
// This will enable designMode while inside a layer and disable it when outside
editor.on('mousedown', function(e) {
var node = e.target, doc = editor.getDoc(), parent;
if (tinymce.Env.gecko) {
if (getParentLayer(node)) {
if (doc.designMode !== 'on') {
doc.designMode = 'on';
// Repaint caret
node = doc.body;
parent = node.parentNode;
parent.removeChild(node);
parent.appendChild(node);
}
} else if (doc.designMode == 'on') {
doc.designMode = 'off';
}
}
});
editor.on('NodeChange', visualAid);
});
tinymce.PluginManager.add("layer",function(a){function b(a){do if(a.className&&-1!=a.className.indexOf("mceItemLayer"))return a;while(a=a.parentNode)}function c(b){var c=a.dom;tinymce.each(c.select("div,p",b),function(a){/^(absolute|relative|fixed)$/i.test(a.style.position)&&(a.hasVisual?c.addClass(a,"mceItemVisualAid"):c.removeClass(a,"mceItemVisualAid"),c.addClass(a,"mceItemLayer"))})}function d(c){var d,e,f=[],g=b(a.selection.getNode()),h=-1,i=-1;for(e=[],tinymce.walk(a.getBody(),function(a){1==a.nodeType&&/^(absolute|relative|static)$/i.test(a.style.position)&&e.push(a)},"childNodes"),d=0;d<e.length;d++)f[d]=e[d].style.zIndex?parseInt(e[d].style.zIndex,10):0,0>h&&e[d]==g&&(h=d);if(0>c){for(d=0;d<f.length;d++)if(f[d]<f[h]){i=d;break}i>-1?(e[h].style.zIndex=f[i],e[i].style.zIndex=f[h]):f[h]>0&&(e[h].style.zIndex=f[h]-1)}else{for(d=0;d<f.length;d++)if(f[d]>f[h]){i=d;break}i>-1?(e[h].style.zIndex=f[i],e[i].style.zIndex=f[h]):e[h].style.zIndex=f[h]+1}a.execCommand("mceRepaint")}function e(){var b=a.dom,c=b.getPos(b.getParent(a.selection.getNode(),"*")),d=a.getBody();a.dom.add(d,"div",{style:{position:"absolute",left:c.x,top:c.y>20?c.y:20,width:100,height:100},"class":"mceItemVisualAid mceItemLayer"},a.selection.getContent()||a.getLang("layer.content")),tinymce.Env.ie&&b.setHTML(d,d.innerHTML)}function f(){var c=b(a.selection.getNode());c||(c=a.dom.getParent(a.selection.getNode(),"DIV,P,IMG")),c&&("absolute"==c.style.position.toLowerCase()?(a.dom.setStyles(c,{position:"",left:"",top:"",width:"",height:""}),a.dom.removeClass(c,"mceItemVisualAid"),a.dom.removeClass(c,"mceItemLayer")):(c.style.left||(c.style.left="20px"),c.style.top||(c.style.top="20px"),c.style.width||(c.style.width=c.width?c.width+"px":"100px"),c.style.height||(c.style.height=c.height?c.height+"px":"100px"),c.style.position="absolute",a.dom.setAttrib(c,"data-mce-style",""),a.addVisual(a.getBody())),a.execCommand("mceRepaint"),a.nodeChanged())}a.addCommand("mceInsertLayer",e),a.addCommand("mceMoveForward",function(){d(1)}),a.addCommand("mceMoveBackward",function(){d(-1)}),a.addCommand("mceMakeAbsolute",function(){f()}),a.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"}),a.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"}),a.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"}),a.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"}),a.on("init",function(){tinymce.Env.ie&&a.getDoc().execCommand("2D-Position",!1,!0)}),a.on("mouseup",function(c){var d=b(c.target);d&&a.dom.setAttrib(d,"data-mce-style","")}),a.on("mousedown",function(c){var d,e=c.target,f=a.getDoc();tinymce.Env.gecko&&(b(e)?"on"!==f.designMode&&(f.designMode="on",e=f.body,d=e.parentNode,d.removeChild(e),d.appendChild(e)):"on"==f.designMode&&(f.designMode="off"))}),a.on("NodeChange",c)});
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*
* This plugin will force TinyMCE to produce deprecated legacy output such as font elements, u elements, align
* attributes and so forth. There are a few cases where these old items might be needed for example in email applications or with Flash
*
* However you should NOT use this plugin if you are building some system that produces web contents such as a CMS. All these elements are
* not apart of the newer specifications for HTML and XHTML.
*/
/*global tinymce:true */
(function(tinymce) {
tinymce.PluginManager.add('legacyoutput', function(editor, url, $) {
editor.settings.inline_styles = false;
editor.on('init', function() {
var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
fontSizes = tinymce.explode(editor.settings.font_size_style_values),
schema = editor.schema;
// Override some internal formats to produce legacy elements and attributes
editor.formatter.register({
// Change alignment formats to use the deprecated align attribute
alignleft: {selector: alignElements, attributes: {align: 'left'}},
aligncenter: {selector: alignElements, attributes: {align: 'center'}},
alignright: {selector: alignElements, attributes: {align: 'right'}},
alignjustify: {selector: alignElements, attributes: {align: 'justify'}},
// Change the basic formatting elements to use deprecated element types
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}
],
// Change font size and font family to use the deprecated font element
fontname: {inline: 'font', attributes: {face: '%value'}},
fontsize: {
inline: 'font',
attributes: {
size: function(vars) {
return tinymce.inArray(fontSizes, vars.value) + 1;
}
}
},
// Setup font elements for colors as well
forecolor: {inline: 'font', attributes: {color: '%value'}},
hilitecolor: {inline: 'font', styles: {backgroundColor: '%value'}}
});
// Check that deprecated elements are allowed if not add them
tinymce.each('b,i,u,strike'.split(','), function(name) {
schema.addValidElements(name + '[*]');
});
// Add font element if it's missing
if (!schema.getElementRule("font")) {
schema.addValidElements("font[face|size|color|style]");
}
// Add the missing and depreacted align attribute for the serialization engine
tinymce.each(alignElements.split(','), function(name) {
var rule = schema.getElementRule(name);
if (rule) {
if (!rule.attributes.align) {
rule.attributes.align = {};
rule.attributesOrder.push('align');
}
}
});
});
editor.addButton('fontsizeselect', function() {
var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7';
var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats;
editor.$.each(fontsize_formats.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);
$.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);
}
}
};
});
});
})(tinymce);
!function(a){a.PluginManager.add("legacyoutput",function(b,c,d){b.settings.inline_styles=!1,b.on("init",function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",d=a.explode(b.settings.font_size_style_values),e=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignjustify:{selector:c,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(b){return a.inArray(d,b.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),a.each("b,i,u,strike".split(","),function(a){e.addValidElements(a+"[*]")}),e.getElementRule("font")||e.addValidElements("font[face|size|color|style]"),a.each(c.split(","),function(a){var b=e.getElementRule(a);b&&(b.attributes.align||(b.attributes.align={},b.attributesOrder.push("align")))})}),b.addButton("fontsizeselect",function(){var a=[],c="8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7",d=b.settings.fontsize_formats||c;return b.$.each(d.split(" "),function(b,c){var d=c,e=c,f=c.split("=");f.length>1&&(d=f[0],e=f[1]),a.push({text:d,value:e})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:a,fixedWidth:!0,onPostRender:function(){var a=this;b.on("NodeChange",function(){var c;c=b.dom.getParent(b.selection.getNode(),"font"),c?a.value(c.size):a.value("")})},onclick:function(a){a.control.settings.value&&b.execCommand("FontSize",!1,a.control.settings.value)}}}),b.addButton("fontselect",function(){function a(a){a=a.replace(/;$/,"").split(";");for(var b=a.length;b--;)a[b]=a[b].split("=");return a}var c="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",e=[],f=a(b.settings.font_formats||c);return d.each(f,function(a,b){e.push({text:{raw:b[0]},value:b[1],textStyle:-1==b[1].indexOf("dings")?"font-family:"+b[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:e,fixedWidth:!0,onPostRender:function(){var a=this;b.on("NodeChange",function(){var c;c=b.dom.getParent(b.selection.getNode(),"font"),c?a.value(c.face):a.value("")})},onselect:function(a){a.control.settings.value&&b.execCommand("FontName",!1,a.control.settings.value)}}})})}(tinymce);
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('link', function(editor) {
function createLinkList(callback) {
return function() {
var linkList = editor.settings.link_list;
if (typeof linkList == "string") {
tinymce.util.XHR.send({
url: linkList,
success: function(text) {
callback(tinymce.util.JSON.parse(text));
}
});
} else if (typeof linkList == "function") {
linkList(callback);
} else {
callback(linkList);
}
};
}
function buildListItems(inputList, itemCallback, startItems) {
function appendItems(values, output) {
output = output || [];
tinymce.each(values, function(item) {
var menuItem = {text: item.text || item.title};
if (item.menu) {
menuItem.menu = appendItems(item.menu);
} else {
menuItem.value = item.value;
if (itemCallback) {
itemCallback(menuItem);
}
}
output.push(menuItem);
});
return output;
}
return appendItems(inputList, startItems || []);
}
function showDialog(linkList) {
var data = {}, selection = editor.selection, dom = editor.dom, selectedElm, anchorElm, initialText;
var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
function linkListChangeHandler(e) {
var textCtrl = win.find('#text');
if (!textCtrl.value() || (e.lastControl && textCtrl.value() == e.lastControl.text())) {
textCtrl.value(e.control.text());
}
win.find('#href').value(e.control.value());
}
function buildAnchorListControl(url) {
var anchorList = [];
tinymce.each(editor.dom.select('a:not([href])'), function(anchor) {
var id = anchor.name || anchor.id;
if (id) {
anchorList.push({
text: id,
value: '#' + id,
selected: url.indexOf('#' + id) != -1
});
}
});
if (anchorList.length) {
anchorList.unshift({text: 'None', value: ''});
return {
name: 'anchor',
type: 'listbox',
label: 'Anchors',
values: anchorList,
onselect: linkListChangeHandler
};
}
}
function updateText() {
if (!initialText && data.text.length === 0 && onlyText) {
this.parent().parent().find('#text')[0].value(this.value());
}
}
function urlChange(e) {
var meta = e.meta || {};
if (linkListCtrl) {
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
}
tinymce.each(e.meta, function(value, key) {
win.find('#' + key).value(value);
});
if (!meta.text) {
updateText.call(this);
}
}
function isOnlyTextSelected(anchorElm) {
var html = selection.getContent();
// Partial html and not a fully selected anchor element
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') == -1)) {
return false;
}
if (anchorElm) {
var nodes = anchorElm.childNodes, i;
if (nodes.length === 0) {
return false;
}
for (i = nodes.length - 1; i >= 0; i--) {
if (nodes[i].nodeType != 3) {
return false;
}
}
}
return true;
}
selectedElm = selection.getNode();
anchorElm = dom.getParent(selectedElm, 'a[href]');
onlyText = isOnlyTextSelected();
data.text = initialText = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({format: 'text'});
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
if (anchorElm) {
data.target = dom.getAttrib(anchorElm, 'target');
} else if (editor.settings.default_link_target) {
data.target = editor.settings.default_link_target;
}
if ((value = dom.getAttrib(anchorElm, 'rel'))) {
data.rel = value;
}
if ((value = dom.getAttrib(anchorElm, 'class'))) {
data['class'] = value;
}
if ((value = dom.getAttrib(anchorElm, 'title'))) {
data.title = value;
}
if (onlyText) {
textListCtrl = {
name: 'text',
type: 'textbox',
size: 40,
label: 'Text to display',
onchange: function() {
data.text = this.value();
}
};
}
if (linkList) {
linkListCtrl = {
type: 'listbox',
label: 'Link list',
values: buildListItems(
linkList,
function(item) {
item.value = editor.convertURL(item.value || item.url, 'href');
},
[{text: 'None', value: ''}]
),
onselect: linkListChangeHandler,
value: editor.convertURL(data.href, 'href'),
onPostRender: function() {
/*eslint consistent-this:0*/
linkListCtrl = this;
}
};
}
if (editor.settings.target_list !== false) {
if (!editor.settings.target_list) {
editor.settings.target_list = [
{text: 'None', value: ''},
{text: 'New window', value: '_blank'}
];
}
targetListCtrl = {
name: 'target',
type: 'listbox',
label: 'Target',
values: buildListItems(editor.settings.target_list)
};
}
if (editor.settings.rel_list) {
relListCtrl = {
name: 'rel',
type: 'listbox',
label: 'Rel',
values: buildListItems(editor.settings.rel_list)
};
}
if (editor.settings.link_class_list) {
classListCtrl = {
name: 'class',
type: 'listbox',
label: 'Class',
values: buildListItems(
editor.settings.link_class_list,
function(item) {
if (item.value) {
item.textStyle = function() {
return editor.formatter.getCssText({inline: 'a', classes: [item.value]});
};
}
}
)
};
}
if (editor.settings.link_title !== false) {
linkTitleCtrl = {
name: 'title',
type: 'textbox',
label: 'Title',
value: data.title
};
}
win = editor.windowManager.open({
title: 'Insert link',
data: data,
body: [
{
name: 'href',
type: 'filepicker',
filetype: 'file',
size: 40,
autofocus: true,
label: 'Url',
onchange: urlChange,
onkeyup: updateText
},
textListCtrl,
linkTitleCtrl,
buildAnchorListControl(data.href),
linkListCtrl,
relListCtrl,
targetListCtrl,
classListCtrl
],
onSubmit: function(e) {
/*eslint dot-notation: 0*/
var href;
data = tinymce.extend(data, e.data);
href = data.href;
// Delay confirm since onSubmit will move focus
function delayedConfirm(message, callback) {
var rng = editor.selection.getRng();
tinymce.util.Delay.setEditorTimeout(editor, function() {
editor.windowManager.confirm(message, function(state) {
editor.selection.setRng(rng);
callback(state);
});
});
}
function insertLink() {
var linkAttrs = {
href: href,
target: data.target ? data.target : null,
rel: data.rel ? data.rel : null,
"class": data["class"] ? data["class"] : null,
title: data.title ? data.title : null
};
if (anchorElm) {
editor.focus();
if (onlyText && data.text != initialText) {
if ("innerText" in anchorElm) {
anchorElm.innerText = data.text;
} else {
anchorElm.textContent = data.text;
}
}
dom.setAttribs(anchorElm, linkAttrs);
selection.select(anchorElm);
editor.undoManager.add();
} else {
if (onlyText) {
editor.insertContent(dom.createHTML('a', linkAttrs, dom.encode(data.text)));
} else {
editor.execCommand('mceInsertLink', false, linkAttrs);
}
}
}
if (!href) {
editor.execCommand('unlink');
return;
}
// Is email and not //user@domain.com
if (href.indexOf('@') > 0 && href.indexOf('//') == -1 && href.indexOf('mailto:') == -1) {
delayedConfirm(
'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',
function(state) {
if (state) {
href = 'mailto:' + href;
}
insertLink();
}
);
return;
}
// Is not protocol prefixed
if ((editor.settings.link_assume_external_targets && !/^\w+:/i.test(href)) ||
(!editor.settings.link_assume_external_targets && /^\s*www[\.|\d\.]/i.test(href))) {
delayedConfirm(
'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
function(state) {
if (state) {
href = 'http://' + href;
}
insertLink();
}
);
return;
}
insertLink();
}
});
}
editor.addButton('link', {
icon: 'link',
tooltip: 'Insert/edit link',
shortcut: 'Meta+K',
onclick: createLinkList(showDialog),
stateSelector: 'a[href]'
});
editor.addButton('unlink', {
icon: 'unlink',
tooltip: 'Remove link',
cmd: 'unlink',
stateSelector: 'a[href]'
});
editor.addShortcut('Meta+K', '', createLinkList(showDialog));
editor.addCommand('mceLink', createLinkList(showDialog));
this.showDialog = showDialog;
editor.addMenuItem('link', {
icon: 'link',
text: 'Insert/edit link',
shortcut: 'Meta+K',
onclick: createLinkList(showDialog),
stateSelector: 'a[href]',
context: 'insert',
prependToContext: true
});
});
tinymce.PluginManager.add("link",function(a){function b(b){return function(){var c=a.settings.link_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b&&b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){function d(a){var b=l.find("#text");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),l.find("#href").value(a.control.value())}function e(b){var c=[];return tinymce.each(a.dom.select("a:not([href])"),function(a){var d=a.name||a.id;d&&c.push({text:d,value:"#"+d,selected:-1!=b.indexOf("#"+d)})}),c.length?(c.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:c,onselect:d}):void 0}function f(){!k&&0===u.text.length&&m&&this.parent().parent().find("#text")[0].value(this.value())}function g(b){var c=b.meta||{};o&&o.value(a.convertURL(this.value(),"href")),tinymce.each(b.meta,function(a,b){l.find("#"+b).value(a)}),c.text||f.call(this)}function h(a){var b=v.getContent();if(/</.test(b)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(b)||-1==b.indexOf("href=")))return!1;if(a){var c,d=a.childNodes;if(0===d.length)return!1;for(c=d.length-1;c>=0;c--)if(3!=d[c].nodeType)return!1}return!0}var i,j,k,l,m,n,o,p,q,r,s,t,u={},v=a.selection,w=a.dom;i=v.getNode(),j=w.getParent(i,"a[href]"),m=h(),u.text=k=j?j.innerText||j.textContent:v.getContent({format:"text"}),u.href=j?w.getAttrib(j,"href"):"",j?u.target=w.getAttrib(j,"target"):a.settings.default_link_target&&(u.target=a.settings.default_link_target),(t=w.getAttrib(j,"rel"))&&(u.rel=t),(t=w.getAttrib(j,"class"))&&(u["class"]=t),(t=w.getAttrib(j,"title"))&&(u.title=t),m&&(n={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){u.text=this.value()}}),b&&(o={type:"listbox",label:"Link list",values:c(b,function(b){b.value=a.convertURL(b.value||b.url,"href")},[{text:"None",value:""}]),onselect:d,value:a.convertURL(u.href,"href"),onPostRender:function(){o=this}}),a.settings.target_list!==!1&&(a.settings.target_list||(a.settings.target_list=[{text:"None",value:""},{text:"New window",value:"_blank"}]),q={name:"target",type:"listbox",label:"Target",values:c(a.settings.target_list)}),a.settings.rel_list&&(p={name:"rel",type:"listbox",label:"Rel",values:c(a.settings.rel_list)}),a.settings.link_class_list&&(r={name:"class",type:"listbox",label:"Class",values:c(a.settings.link_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"a",classes:[b.value]})})})}),a.settings.link_title!==!1&&(s={name:"title",type:"textbox",label:"Title",value:u.title}),l=a.windowManager.open({title:"Insert link",data:u,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:g,onkeyup:f},n,s,e(u.href),o,p,q,r],onSubmit:function(b){function c(b,c){var d=a.selection.getRng();tinymce.util.Delay.setEditorTimeout(a,function(){a.windowManager.confirm(b,function(b){a.selection.setRng(d),c(b)})})}function d(){var b={href:e,target:u.target?u.target:null,rel:u.rel?u.rel:null,"class":u["class"]?u["class"]:null,title:u.title?u.title:null};j?(a.focus(),m&&u.text!=k&&("innerText"in j?j.innerText=u.text:j.textContent=u.text),w.setAttribs(j,b),v.select(j),a.undoManager.add()):m?a.insertContent(w.createHTML("a",b,w.encode(u.text))):a.execCommand("mceInsertLink",!1,b)}var e;return u=tinymce.extend(u,b.data),(e=u.href)?e.indexOf("@")>0&&-1==e.indexOf("//")&&-1==e.indexOf("mailto:")?void c("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(a){a&&(e="mailto:"+e),d()}):a.settings.link_assume_external_targets&&!/^\w+:/i.test(e)||!a.settings.link_assume_external_targets&&/^\s*www[\.|\d\.]/i.test(e)?void c("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(a){a&&(e="http://"+e),d()}):void d():void a.execCommand("unlink")}})}a.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onclick:b(d),stateSelector:"a[href]"}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"}),a.addShortcut("Meta+K","",b(d)),a.addCommand("mceLink",b(d)),this.showDialog=d,a.addMenuItem("link",{icon:"link",text:"Insert/edit link",shortcut:"Meta+K",onclick:b(d),stateSelector:"a[href]",context:"insert",prependToContext:!0})});
\ No newline at end of file
tinymce.PluginManager.add("lists",function(a){function b(b){return a.$.contains(a.getBody(),b)}function c(a){return a&&"BR"==a.nodeName}function d(a){return a&&/^(OL|UL|DL)$/.test(a.nodeName)&&b(a)}function e(a){return a&&/^(LI|DT|DD)$/.test(a.nodeName)}function f(a){return a.parentNode.firstChild==a}function g(a){return a.parentNode.lastChild==a}function h(b){return b&&!!a.schema.getTextBlockElements()[b.nodeName]}function i(b){return b===a.getBody()}function j(a){return a&&3===a.nodeType}function k(a,b){var c=tinymce.dom.RangeUtils.getNode(a,b);if(e(a)&&j(c)){var d=b>=a.childNodes.length?c.data.length:0;return{container:c,offset:d}}return{container:a,offset:b}}function l(a){var b=a.cloneRange(),c=k(a.startContainer,a.startOffset);b.setStart(c.container,c.offset);var d=k(a.endContainer,a.endOffset);return b.setEnd(d.container,d.offset),b}var m=this;a.on("init",function(){function j(a,b){var c=H.isEmpty(a);return b&&H.select("span[data-mce-type=bookmark]").length>0?!1:c}function k(a){function b(b){var d,e,f;e=a[b?"startContainer":"endContainer"],f=a[b?"startOffset":"endOffset"],1==e.nodeType&&(d=H.create("span",{"data-mce-type":"bookmark"}),e.hasChildNodes()?(f=Math.min(f,e.childNodes.length-1),b?e.insertBefore(d,e.childNodes[f]):H.insertAfter(d,e.childNodes[f])):e.appendChild(d),e=d,f=0),c[b?"startContainer":"endContainer"]=e,c[b?"startOffset":"endOffset"]=f}var c={};return b(!0),a.collapsed||b(),c}function n(a){function b(b){function c(a){for(var b=a.parentNode.firstChild,c=0;b;){if(b==a)return c;1==b.nodeType&&"bookmark"==b.getAttribute("data-mce-type")||c++,b=b.nextSibling}return-1}var d,e,f;d=f=a[b?"startContainer":"endContainer"],e=a[b?"startOffset":"endOffset"],d&&(1==d.nodeType&&(e=c(d),d=d.parentNode,H.remove(f)),a[b?"startContainer":"endContainer"]=d,a[b?"startOffset":"endOffset"]=e)}b(!0),b();var c=H.createRng();c.setStart(a.startContainer,a.startOffset),a.endContainer&&c.setEnd(a.endContainer,a.endOffset),I.setRng(l(c))}function o(b,c){var d,e,f,g=H.createFragment(),h=a.schema.getBlockElements();if(a.settings.forced_root_block&&(c=c||a.settings.forced_root_block),c&&(e=H.create(c),e.tagName===a.settings.forced_root_block&&H.setAttribs(e,a.settings.forced_root_block_attrs),g.appendChild(e)),b)for(;d=b.firstChild;){var i=d.nodeName;f||"SPAN"==i&&"bookmark"==d.getAttribute("data-mce-type")||(f=!0),h[i]?(g.appendChild(d),e=null):c?(e||(e=H.create(c),g.appendChild(e)),e.appendChild(d)):g.appendChild(d)}return a.settings.forced_root_block?f||tinymce.Env.ie&&!(tinymce.Env.ie>10)||e.appendChild(H.create("br",{"data-mce-bogus":"1"})):g.appendChild(H.create("br")),g}function p(){return tinymce.grep(I.getSelectedBlocks(),function(a){return e(a)})}function q(a,b,c){function d(a){tinymce.each(g,function(c){a.parentNode.insertBefore(c,b.parentNode)}),H.remove(a)}var e,f,g,h;for(g=H.select('span[data-mce-type="bookmark"]',a),c=c||o(b),e=H.createRng(),e.setStartAfter(b),e.setEndAfter(a),f=e.extractContents(),h=f.firstChild;h;h=h.firstChild)if("LI"==h.nodeName&&H.isEmpty(h)){H.remove(h);break}H.isEmpty(f)||H.insertAfter(f,a),H.insertAfter(c,a),j(b.parentNode)&&d(b.parentNode),H.remove(b),j(a)&&H.remove(a)}function r(a){var b,c;if(b=a.nextSibling,b&&d(b)&&b.nodeName==a.nodeName&&J(a,b)){for(;c=b.firstChild;)a.appendChild(c);H.remove(b)}if(b=a.previousSibling,b&&d(b)&&b.nodeName==a.nodeName&&J(a,b)){for(;c=b.firstChild;)a.insertBefore(c,a.firstChild);H.remove(b)}}function s(a){tinymce.each(tinymce.grep(H.select("ol,ul",a)),t)}function t(a){var b,c=a.parentNode;"LI"==c.nodeName&&c.firstChild==a&&(b=c.previousSibling,b&&"LI"==b.nodeName?(b.appendChild(a),j(c)&&H.remove(c)):H.setStyle(c,"listStyleType","none")),d(c)&&(b=c.previousSibling,b&&"LI"==b.nodeName&&b.appendChild(a))}function u(a){function b(a){j(a)&&H.remove(a)}var c,e=a.parentNode,h=e.parentNode;return i(e)?!0:"DD"==a.nodeName?(H.rename(a,"DT"),!0):f(a)&&g(a)?("LI"==h.nodeName?(H.insertAfter(a,h),b(h),H.remove(e)):d(h)?H.remove(e,!0):(h.insertBefore(o(a),e),H.remove(e)),!0):f(a)?("LI"==h.nodeName?(H.insertAfter(a,h),a.appendChild(e),b(h)):d(h)?h.insertBefore(a,e):(h.insertBefore(o(a),e),H.remove(a)),!0):g(a)?("LI"==h.nodeName?H.insertAfter(a,h):d(h)?H.insertAfter(a,e):(H.insertAfter(o(a),e),H.remove(a)),!0):("LI"==h.nodeName?(e=h,c=o(a,"LI")):c=d(h)?o(a,"LI"):o(a),q(e,a,c),s(e.parentNode),!0)}function v(a){function b(b,c){var e;if(d(b)){for(;e=a.lastChild.firstChild;)c.appendChild(e);H.remove(b)}}var c,e,f;return"DT"==a.nodeName?(H.rename(a,"DD"),!0):(c=a.previousSibling,c&&d(c)?(c.appendChild(a),!0):c&&"LI"==c.nodeName&&d(c.lastChild)?(c.lastChild.appendChild(a),b(a.lastChild,c.lastChild),!0):(c=a.nextSibling,c&&d(c)?(c.insertBefore(a,c.firstChild),!0):(c=a.previousSibling,c&&"LI"==c.nodeName?(e=H.create(a.parentNode.nodeName),f=H.getStyle(a.parentNode,"listStyleType"),f&&H.setStyle(e,"listStyleType",f),c.appendChild(e),e.appendChild(a),b(a.lastChild,e),!0):!1)))}function w(){var b=p();if(b.length){for(var c=k(I.getRng(!0)),d=0;d<b.length&&(v(b[d])||0!==d);d++);return n(c),a.nodeChanged(),!0}}function x(){var b=p();if(b.length){var c,d,e=k(I.getRng(!0)),f=a.getBody();for(c=b.length;c--;)for(var g=b[c].parentNode;g&&g!=f;){for(d=b.length;d--;)if(b[d]===g){b.splice(c,1);break}g=g.parentNode}for(c=0;c<b.length&&(u(b[c])||0!==c);c++);return n(e),a.nodeChanged(),!0}}function y(b,e){function f(){function b(a){var b,c;for(b=i[a?"startContainer":"endContainer"],c=i[a?"startOffset":"endOffset"],1==b.nodeType&&(b=b.childNodes[Math.min(c,b.childNodes.length-1)]||b);b.parentNode!=f;){if(h(b))return b;if(/^(TD|TH)$/.test(b.parentNode.nodeName))return b;b=b.parentNode}return b}for(var d,e=[],f=a.getBody(),g=b(!0),j=b(),k=[],l=g;l&&(k.push(l),l!=j);l=l.nextSibling);return tinymce.each(k,function(a){if(h(a))return e.push(a),void(d=null);if(H.isBlock(a)||c(a))return c(a)&&H.remove(a),void(d=null);var b=a.nextSibling;return tinymce.dom.BookmarkManager.isBookmarkNode(a)&&(h(b)||!b&&a.parentNode==f)?void(d=null):(d||(d=H.create("p"),a.parentNode.insertBefore(d,a),e.push(d)),void d.appendChild(a))}),e}var g,i=I.getRng(!0),j="LI";"false"!==H.getContentEditable(I.getNode())&&(b=b.toUpperCase(),"DL"==b&&(j="DT"),g=k(i),tinymce.each(f(),function(a){var c,f,g=function(a){var b=H.getStyle(a,"list-style-type"),c=e?e["list-style-type"]:"";return c=null===c?"":c,b===c};f=a.previousSibling,f&&d(f)&&f.nodeName==b&&g(f)?(c=f,a=H.rename(a,j),f.appendChild(a)):(c=H.create(b),a.parentNode.insertBefore(c,a),c.appendChild(a),a=H.rename(a,j)),K(c,e),r(c)}),n(g))}function z(){var b=k(I.getRng(!0)),c=a.getBody();tinymce.each(p(),function(a){var b,e;if(!i(a.parentNode)){if(j(a))return void u(a);for(b=a;b&&b!=c;b=b.parentNode)d(b)&&(e=b);q(e,a),s(e.parentNode)}}),n(b)}function A(a,b){var c=H.getParent(I.getStart(),"OL,UL,DL");if(!i(c))if(c)if(c.nodeName==a)z(a);else{var d=k(I.getRng(!0));K(c,b),r(H.rename(c,a)),n(d)}else y(a,b)}function B(b){return function(){var c=H.getParent(a.selection.getStart(),"UL,OL,DL");return c&&c.nodeName==b}}function C(a){return c(a)?!(!H.isBlock(a.nextSibling)||c(a.previousSibling)):!1}function D(b,c){var d,e,f=b.startContainer,g=b.startOffset;if(3==f.nodeType&&(c?g<f.data.length:g>0))return f;for(d=a.schema.getNonEmptyElements(),1==f.nodeType&&(f=tinymce.dom.RangeUtils.getNode(f,g)),e=new tinymce.dom.TreeWalker(f,a.getBody()),c&&C(f)&&e.next();f=e[c?"next":"prev2"]();){if("LI"==f.nodeName&&!f.hasChildNodes())return f;if(d[f.nodeName])return f;if(3==f.nodeType&&f.data.length>0)return f}}function E(a,e){var f,g,h=a.parentNode;if(b(a)&&b(e)){if(d(e.lastChild)&&(g=e.lastChild),h==e.lastChild&&c(h.previousSibling)&&H.remove(h.previousSibling),f=e.lastChild,f&&c(f)&&a.hasChildNodes()&&H.remove(f),j(e,!0)&&H.$(e).empty(),!j(a,!0))for(;f=a.firstChild;)e.appendChild(f);g&&e.appendChild(g),H.remove(a),j(h)&&!i(h)&&H.remove(h)}}function F(a){var b,c,d,e=H.getParent(I.getStart(),"LI");if(e){if(b=e.parentNode,i(b)&&H.isEmpty(b))return!0;if(c=l(I.getRng(!0)),d=H.getParent(D(c,a),"LI"),d&&d!=e){var f=k(c);return a?E(d,e):E(e,d),n(f),!0}if(!d&&!a&&z(b.nodeName))return!0}}function G(){var b=a.dom.getParent(a.selection.getStart(),"LI,DT,DD");return b||p().length>0?(a.undoManager.transact(function(){a.execCommand("Delete"),s(a.getBody())}),!0):!1}var H=a.dom,I=a.selection,J=function(b,c){var d=a.dom.getStyle(b,"list-style-type",!0),e=a.dom.getStyle(c,"list-style-type",!0);return d===e},K=function(a,b){H.setStyle(a,"list-style-type",b?b["list-style-type"]:null)};m.backspaceDelete=function(a){return I.isCollapsed()?F(a):G()},a.on("BeforeExecCommand",function(b){var c,d=b.command.toLowerCase();return"indent"==d?w()&&(c=!0):"outdent"==d&&x()&&(c=!0),c?(a.fire("ExecCommand",{command:b.command}),b.preventDefault(),!0):void 0}),a.addCommand("InsertUnorderedList",function(a,b){A("UL",b)}),a.addCommand("InsertOrderedList",function(a,b){A("OL",b)}),a.addCommand("InsertDefinitionList",function(a,b){A("DL",b)}),a.addQueryStateHandler("InsertUnorderedList",B("UL")),a.addQueryStateHandler("InsertOrderedList",B("OL")),a.addQueryStateHandler("InsertDefinitionList",B("DL")),a.on("keydown",function(b){9!=b.keyCode||tinymce.util.VK.metaKeyPressed(b)||a.dom.getParent(a.selection.getStart(),"LI,DT,DD")&&(b.preventDefault(),b.shiftKey?x():w())})}),a.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:function(){var b=this;a.on("nodechange",function(){for(var c=a.selection.getSelectedBlocks(),d=!1,e=0,g=c.length;!d&&g>e;e++){var h=c[e].nodeName;d="LI"==h&&f(c[e])||"UL"==h||"OL"==h||"DD"==h}b.disabled(d)})}}),a.on("keydown",function(a){a.keyCode==tinymce.util.VK.BACKSPACE?m.backspaceDelete()&&a.preventDefault():a.keyCode==tinymce.util.VK.DELETE&&m.backspaceDelete(!0)&&a.preventDefault()})});
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('nonbreaking', function(editor) {
var setting = editor.getParam('nonbreaking_force_tab');
editor.addCommand('mceNonBreaking', function() {
editor.insertContent(
(editor.plugins.visualchars && editor.plugins.visualchars.state) ?
'<span class="mce-nbsp">&nbsp;</span>' : '&nbsp;'
);
editor.dom.setAttrib(editor.dom.select('span.mce-nbsp'), 'data-mce-bogus', '1');
});
editor.addButton('nonbreaking', {
title: 'Nonbreaking space',
cmd: 'mceNonBreaking'
});
editor.addMenuItem('nonbreaking', {
text: 'Nonbreaking space',
cmd: 'mceNonBreaking',
context: 'insert'
});
if (setting) {
var spaces = +setting > 1 ? +setting : 3; // defaults to 3 spaces if setting is true (or 1)
editor.on('keydown', function(e) {
if (e.keyCode == 9) {
if (e.shiftKey) {
return;
}
e.preventDefault();
for (var i = 0; i < spaces; i++) {
editor.execCommand('mceNonBreaking');
}
}
});
}
});
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('noneditable', function(editor) {
var editClass, nonEditClass, nonEditableRegExps, contentEditableAttrName = 'contenteditable';
function hasClass(checkClassName) {
return function(node) {
return (" " + node.attr("class") + " ").indexOf(checkClassName) !== -1;
};
}
function convertRegExpsToNonEditable(e) {
var i = nonEditableRegExps.length, content = e.content, cls = tinymce.trim(nonEditClass);
function replaceMatchWithSpan(match) {
var args = arguments, index = args[args.length - 2];
// Is value inside an attribute then don't replace
if (index > 0 && content.charAt(index - 1) == '"') {
return match;
}
return (
'<span class="' + cls + '" data-mce-content="' + editor.dom.encode(args[0]) + '">' +
editor.dom.encode(typeof args[1] === "string" ? args[1] : args[0]) + '</span>'
);
}
// Don't replace the variables when raw is used for example on undo/redo
if (e.format == "raw") {
return;
}
while (i--) {
content = content.replace(nonEditableRegExps[i], replaceMatchWithSpan);
}
e.content = content;
}
editClass = " " + tinymce.trim(editor.getParam("noneditable_editable_class", "mceEditable")) + " ";
nonEditClass = " " + tinymce.trim(editor.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";
var hasEditClass = hasClass(editClass);
var hasNonEditClass = hasClass(nonEditClass);
nonEditableRegExps = editor.getParam("noneditable_regexp");
if (nonEditableRegExps && !nonEditableRegExps.length) {
nonEditableRegExps = [nonEditableRegExps];
}
editor.on('PreInit', function() {
if (nonEditableRegExps) {
editor.on('BeforeSetContent', convertRegExpsToNonEditable);
}
editor.parser.addAttributeFilter('class', function(nodes) {
var i = nodes.length, node;
while (i--) {
node = nodes[i];
if (hasEditClass(node)) {
node.attr(contentEditableAttrName, "true");
} else if (hasNonEditClass(node)) {
node.attr(contentEditableAttrName, "false");
}
}
});
editor.serializer.addAttributeFilter(contentEditableAttrName, function(nodes) {
var i = nodes.length, node;
while (i--) {
node = nodes[i];
if (!hasEditClass(node) && !hasNonEditClass(node)) {
continue;
}
if (nonEditableRegExps && node.attr('data-mce-content')) {
node.name = "#text";
node.type = 3;
node.raw = true;
node.value = node.attr('data-mce-content');
} else {
node.attr(contentEditableAttrName, null);
}
}
});
});
});
\ No newline at end of file
tinymce.PluginManager.add("noneditable",function(a){function b(a){return function(b){return-1!==(" "+b.attr("class")+" ").indexOf(a)}}function c(b){function c(b){var c=arguments,d=c[c.length-2];return d>0&&'"'==g.charAt(d-1)?b:'<span class="'+h+'" data-mce-content="'+a.dom.encode(c[0])+'">'+a.dom.encode("string"==typeof c[1]?c[1]:c[0])+"</span>"}var d=f.length,g=b.content,h=tinymce.trim(e);if("raw"!=b.format){for(;d--;)g=g.replace(f[d],c);b.content=g}}var d,e,f,g="contenteditable";d=" "+tinymce.trim(a.getParam("noneditable_editable_class","mceEditable"))+" ",e=" "+tinymce.trim(a.getParam("noneditable_noneditable_class","mceNonEditable"))+" ";var h=b(d),i=b(e);f=a.getParam("noneditable_regexp"),f&&!f.length&&(f=[f]),a.on("PreInit",function(){f&&a.on("BeforeSetContent",c),a.parser.addAttributeFilter("class",function(a){for(var b,c=a.length;c--;)b=a[c],h(b)?b.attr(g,"true"):i(b)&&b.attr(g,"false")}),a.serializer.addAttributeFilter(g,function(a){for(var b,c=a.length;c--;)b=a[c],(h(b)||i(b))&&(f&&b.attr("data-mce-content")?(b.name="#text",b.type=3,b.raw=!0,b.value=b.attr("data-mce-content")):b.attr(g,null))})})});
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('pagebreak', function(editor) {
var pageBreakClass = 'mce-pagebreak', separatorHtml = editor.getParam('pagebreak_separator', '<!-- pagebreak -->');
var pageBreakSeparatorRegExp = new RegExp(separatorHtml.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {
return '\\' + a;
}), 'gi');
var pageBreakPlaceHolderHtml = '<img src="' + tinymce.Env.transparentSrc + '" class="' +
pageBreakClass + '" data-mce-resize="false" data-mce-placeholder />';
// Register commands
editor.addCommand('mcePageBreak', function() {
if (editor.settings.pagebreak_split_block) {
editor.insertContent('<p>' + pageBreakPlaceHolderHtml + '</p>');
} else {
editor.insertContent(pageBreakPlaceHolderHtml);
}
});
// Register buttons
editor.addButton('pagebreak', {
title: 'Page break',
cmd: 'mcePageBreak'
});
editor.addMenuItem('pagebreak', {
text: 'Page break',
icon: 'pagebreak',
cmd: 'mcePageBreak',
context: 'insert'
});
editor.on('ResolveName', function(e) {
if (e.target.nodeName == 'IMG' && editor.dom.hasClass(e.target, pageBreakClass)) {
e.name = 'pagebreak';
}
});
editor.on('click', function(e) {
e = e.target;
if (e.nodeName === 'IMG' && editor.dom.hasClass(e, pageBreakClass)) {
editor.selection.select(e);
}
});
editor.on('BeforeSetContent', function(e) {
e.content = e.content.replace(pageBreakSeparatorRegExp, pageBreakPlaceHolderHtml);
});
editor.on('PreInit', function() {
editor.serializer.addNodeFilter('img', function(nodes) {
var i = nodes.length, node, className;
while (i--) {
node = nodes[i];
className = node.attr('class');
if (className && className.indexOf('mce-pagebreak') !== -1) {
// Replace parent block node if pagebreak_split_block is enabled
var parentNode = node.parent;
if (editor.schema.getBlockElements()[parentNode.name] && editor.settings.pagebreak_split_block) {
parentNode.type = 3;
parentNode.value = separatorHtml;
parentNode.raw = true;
node.remove();
continue;
}
node.type = 3;
node.value = separatorHtml;
node.raw = true;
}
}
});
});
});
tinymce.PluginManager.add("pagebreak",function(a){var b="mce-pagebreak",c=a.getParam("pagebreak_separator","<!-- pagebreak -->"),d=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(a){return"\\"+a}),"gi"),e='<img src="'+tinymce.Env.transparentSrc+'" class="'+b+'" data-mce-resize="false" data-mce-placeholder />';a.addCommand("mcePageBreak",function(){a.settings.pagebreak_split_block?a.insertContent("<p>"+e+"</p>"):a.insertContent(e)}),a.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),a.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"}),a.on("ResolveName",function(c){"IMG"==c.target.nodeName&&a.dom.hasClass(c.target,b)&&(c.name="pagebreak")}),a.on("click",function(c){c=c.target,"IMG"===c.nodeName&&a.dom.hasClass(c,b)&&a.selection.select(c)}),a.on("BeforeSetContent",function(a){a.content=a.content.replace(d,e)}),a.on("PreInit",function(){a.serializer.addNodeFilter("img",function(b){for(var d,e,f=b.length;f--;)if(d=b[f],e=d.attr("class"),e&&-1!==e.indexOf("mce-pagebreak")){var g=d.parent;if(a.schema.getBlockElements()[g.name]&&a.settings.pagebreak_split_block){g.type=3,g.value=c,g.raw=!0,d.remove();continue}d.type=3,d.value=c,d.raw=!0}})})});
\ No newline at end of file
/**
* Plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* This class contains the tinymce plugin logic for the paste plugin.
*
* @class tinymce.pasteplugin.Plugin
* @private
*/
define("tinymce/pasteplugin/Plugin", [
"tinymce/PluginManager",
"tinymce/pasteplugin/Clipboard",
"tinymce/pasteplugin/WordFilter",
"tinymce/pasteplugin/Quirks"
], function(PluginManager, Clipboard, WordFilter, Quirks) {
var userIsInformed;
PluginManager.add('paste', function(editor) {
var self = this, clipboard, settings = editor.settings;
function isUserInformedAboutPlainText() {
return userIsInformed || editor.settings.paste_plaintext_inform === false;
}
function togglePlainTextPaste() {
if (clipboard.pasteFormat == "text") {
this.active(false);
clipboard.pasteFormat = "html";
editor.fire('PastePlainTextToggle', {state: false});
} else {
clipboard.pasteFormat = "text";
this.active(true);
if (!isUserInformedAboutPlainText()) {
var message = editor.translate('Paste is now in plain text mode. Contents will now ' +
'be pasted as plain text until you toggle this option off.');
editor.notificationManager.open({
text: message,
type: 'info'
});
userIsInformed = true;
editor.fire('PastePlainTextToggle', {state: true});
}
}
editor.focus();
}
// draw back if power version is requested and registered
if (/(^|[ ,])powerpaste([, ]|$)/.test(settings.plugins) && PluginManager.get('powerpaste')) {
/*eslint no-console:0 */
if (typeof console !== "undefined" && console.log) {
console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option.");
}
return;
}
self.clipboard = clipboard = new Clipboard(editor);
self.quirks = new Quirks(editor);
self.wordFilter = new WordFilter(editor);
if (editor.settings.paste_as_text) {
self.clipboard.pasteFormat = "text";
}
if (settings.paste_preprocess) {
editor.on('PastePreProcess', function(e) {
settings.paste_preprocess.call(self, self, e);
});
}
if (settings.paste_postprocess) {
editor.on('PastePostProcess', function(e) {
settings.paste_postprocess.call(self, self, e);
});
}
editor.addCommand('mceInsertClipboardContent', function(ui, value) {
if (value.content) {
self.clipboard.pasteHtml(value.content);
}
if (value.text) {
self.clipboard.pasteText(value.text);
}
});
// Block all drag/drop events
if (editor.settings.paste_block_drop) {
editor.on('dragend dragover draggesture dragdrop drop drag', function(e) {
e.preventDefault();
e.stopPropagation();
});
}
// Prevent users from dropping data images on Gecko
if (!editor.settings.paste_data_images) {
editor.on('drop', function(e) {
var dataTransfer = e.dataTransfer;
if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
e.preventDefault();
}
});
}
editor.addButton('pastetext', {
icon: 'pastetext',
tooltip: 'Paste as text',
onclick: togglePlainTextPaste,
active: self.clipboard.pasteFormat == "text"
});
editor.addMenuItem('pastetext', {
text: 'Paste as text',
selectable: true,
active: clipboard.pasteFormat,
onclick: togglePlainTextPaste
});
});
});
/**
* Quirks.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* This class contains various fixes for browsers. These issues can not be feature
* detected since we have no direct control over the clipboard. However we might be able
* to remove some of these fixes once the browsers gets updated/fixed.
*
* @class tinymce.pasteplugin.Quirks
* @private
*/
define("tinymce/pasteplugin/Quirks", [
"tinymce/Env",
"tinymce/util/Tools",
"tinymce/pasteplugin/WordFilter",
"tinymce/pasteplugin/Utils"
], function(Env, Tools, WordFilter, Utils) {
"use strict";
return function(editor) {
function addPreProcessFilter(filterFunc) {
editor.on('BeforePastePreProcess', function(e) {
e.content = filterFunc(e.content);
});
}
/**
* Removes BR elements after block elements. IE9 has a nasty bug where it puts a BR element after each
* block element when pasting from word. This removes those elements.
*
* This:
* <p>a</p><br><p>b</p>
*
* Becomes:
* <p>a</p><p>b</p>
*/
function removeExplorerBrElementsAfterBlocks(html) {
// Only filter word specific content
if (!WordFilter.isWordContent(html)) {
return html;
}
// Produce block regexp based on the block elements in schema
var blockElements = [];
Tools.each(editor.schema.getBlockElements(), function(block, blockName) {
blockElements.push(blockName);
});
var explorerBlocksRegExp = new RegExp(
'(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*',
'g'
);
// Remove BR:s from: <BLOCK>X</BLOCK><BR>
html = Utils.filter(html, [
[explorerBlocksRegExp, '$1']
]);
// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
html = Utils.filter(html, [
[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
[/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
[/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
]);
return html;
}
/**
* WebKit has a nasty bug where the all computed styles gets added to style attributes when copy/pasting contents.
* This fix solves that by simply removing the whole style attribute.
*
* The paste_webkit_styles option can be set to specify what to keep:
* paste_webkit_styles: "none" // Keep no styles
* paste_webkit_styles: "all", // Keep all of them
* paste_webkit_styles: "font-weight color" // Keep specific ones
*
* @param {String} content Content that needs to be processed.
* @return {String} Processed contents.
*/
function removeWebKitStyles(content) {
// Passthrough all styles from Word and let the WordFilter handle that junk
if (WordFilter.isWordContent(content)) {
return content;
}
// Filter away styles that isn't matching the target node
var webKitStyles = editor.settings.paste_webkit_styles;
if (editor.settings.paste_remove_styles_if_webkit === false || webKitStyles == "all") {
return content;
}
if (webKitStyles) {
webKitStyles = webKitStyles.split(/[, ]/);
}
// Keep specific styles that doesn't match the current node computed style
if (webKitStyles) {
var dom = editor.dom, node = editor.selection.getNode();
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function(all, before, value, after) {
var inputStyles = dom.parseStyle(value, 'span'), outputStyles = {};
if (webKitStyles === "none") {
return before + after;
}
for (var i = 0; i < webKitStyles.length; i++) {
var inputValue = inputStyles[webKitStyles[i]], currentValue = dom.getStyle(node, webKitStyles[i], true);
if (/color/.test(webKitStyles[i])) {
inputValue = dom.toHex(inputValue);
currentValue = dom.toHex(currentValue);
}
if (currentValue != inputValue) {
outputStyles[webKitStyles[i]] = inputValue;
}
}
outputStyles = dom.serializeStyle(outputStyles, 'span');
if (outputStyles) {
return before + ' style="' + outputStyles + '"' + after;
}
return before + after;
});
} else {
// Remove all external styles
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
}
// Keep internal styles
content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function(all, before, value, after) {
return before + ' style="' + value + '"' + after;
});
return content;
}
// Sniff browsers and apply fixes since we can't feature detect
if (Env.webkit) {
addPreProcessFilter(removeWebKitStyles);
}
if (Env.ie) {
addPreProcessFilter(removeExplorerBrElementsAfterBlocks);
}
};
});
\ No newline at end of file
/**
* SmartPaste.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* Tries to be smart depending on what the user pastes if it looks like an url
* it will make a link out of the current selection. If it's an image url that looks
* like an image it will check if it's an image and insert it as an image.
*
* @class tinymce.pasteplugin.SmartPaste
* @private
*/
define("tinymce/pasteplugin/SmartPaste", [
"tinymce/util/Tools"
], function (Tools) {
var isAbsoluteUrl = function (url) {
return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);
};
var isImageUrl = function (url) {
return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);
};
var createImage = function (editor, url, pasteHtml) {
editor.undoManager.extra(function () {
pasteHtml(editor, url);
}, function () {
editor.insertContent('<img src="' + url + '">');
});
return true;
};
var createLink = function (editor, url, pasteHtml) {
editor.undoManager.extra(function () {
pasteHtml(editor, url);
}, function () {
editor.execCommand('mceInsertLink', false, url);
});
return true;
};
var linkSelection = function (editor, html, pasteHtml) {
return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtml) : false;
};
var insertImage = function (editor, html, pasteHtml) {
return isImageUrl(html) ? createImage(editor, html, pasteHtml) : false;
};
var pasteHtml = function (editor, html) {
editor.insertContent(html, {
merge: editor.settings.paste_merge_formats !== false,
paste: true
});
return true;
};
var smartInsertContent = function (editor, html) {
Tools.each([
linkSelection,
insertImage,
pasteHtml
], function (action) {
return action(editor, html, pasteHtml) !== true;
});
};
var insertContent = function (editor, html) {
if (editor.settings.smart_paste === false) {
pasteHtml(editor, html);
} else {
smartInsertContent(editor, html);
}
};
return {
isImageUrl: isImageUrl,
isAbsoluteUrl: isAbsoluteUrl,
insertContent: insertContent
};
});
/**
* Utils.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* This class contails various utility functions for the paste plugin.
*
* @class tinymce.pasteplugin.Utils
*/
define("tinymce/pasteplugin/Utils", [
"tinymce/util/Tools",
"tinymce/html/DomParser",
"tinymce/html/Schema"
], function(Tools, DomParser, Schema) {
function filter(content, items) {
Tools.each(items, function(v) {
if (v.constructor == RegExp) {
content = content.replace(v, '');
} else {
content = content.replace(v[0], v[1]);
}
});
return content;
}
/**
* Gets the innerText of the specified element. It will handle edge cases
* and works better than textContent on Gecko.
*
* @param {String} html HTML string to get text from.
* @return {String} String of text with line feeds.
*/
function innerText(html) {
var schema = new Schema(), domParser = new DomParser({}, schema), text = '';
var shortEndedElements = schema.getShortEndedElements();
var ignoreElements = Tools.makeMap('script noscript style textarea video audio iframe object', ' ');
var blockElements = schema.getBlockElements();
function walk(node) {
var name = node.name, currentNode = node;
if (name === 'br') {
text += '\n';
return;
}
// img/input/hr
if (shortEndedElements[name]) {
text += ' ';
}
// Ingore script, video contents
if (ignoreElements[name]) {
text += ' ';
return;
}
if (node.type == 3) {
text += node.value;
}
// Walk all children
if (!node.shortEnded) {
if ((node = node.firstChild)) {
do {
walk(node);
} while ((node = node.next));
}
}
// Add \n or \n\n for blocks or P
if (blockElements[name] && currentNode.next) {
text += '\n';
if (name == 'p') {
text += '\n';
}
}
}
html = filter(html, [
/<!\[[^\]]+\]>/g // Conditional comments
]);
walk(domParser.parse(html));
return text;
}
/**
* Trims the specified HTML by removing all WebKit fragments, all elements wrapping the body trailing BR elements etc.
*
* @param {String} html Html string to trim contents on.
* @return {String} Html contents that got trimmed.
*/
function trimHtml(html) {
function trimSpaces(all, s1, s2) {
// WebKit &nbsp; meant to preserve multiple spaces but instead inserted around all inline tags,
// including the spans with inline styles created on paste
if (!s1 && !s2) {
return ' ';
}
return '\u00a0';
}
html = filter(html, [
/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g, // Remove anything but the contents within the BODY element
/<!--StartFragment-->|<!--EndFragment-->/g, // Inner fragments (tables from excel on mac)
[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g, trimSpaces],
/<br class="Apple-interchange-newline">/g,
/<br>$/i // Trailing BR elements
]);
return html;
}
// TODO: Should be in some global class
function createIdGenerator(prefix) {
var count = 0;
return function() {
return prefix + (count++);
};
}
return {
filter: filter,
innerText: innerText,
trimHtml: trimHtml,
createIdGenerator: createIdGenerator
};
});
/**
* Inline development version. Only to be used while developing since it uses document.write to load scripts.
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports) {
"use strict";
var html = "", baseDir;
var modules = {}, exposedModules = [], moduleCount = 0;
var scripts = document.getElementsByTagName('script');
for (var i = 0; i < scripts.length; i++) {
var src = scripts[i].src;
if (src.indexOf('/plugin.dev.js') != -1) {
baseDir = src.substring(0, src.lastIndexOf('/'));
}
}
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function resolve(id) {
if (exports.privateModules && id in exports.privateModules) {
return;
}
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function register(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
function define(id, dependencies, definition) {
var privateModules, i;
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
if (--moduleCount === 0) {
for (i = 0; i < exposedModules.length; i++) {
register(exposedModules[i]);
}
}
// Expose private modules for unit tests
if (exports.AMDLC_TESTS) {
privateModules = exports.privateModules || {};
for (id in modules) {
privateModules[id] = modules[id];
}
for (i = 0; i < exposedModules.length; i++) {
delete privateModules[exposedModules[i]];
}
exports.privateModules = privateModules;
}
}
function expose(ids) {
exposedModules = ids;
}
function writeScripts() {
document.write(html);
}
function load(path) {
html += '<script type="text/javascript" src="' + baseDir + '/' + path + '"></script>\n';
moduleCount++;
}
// Expose globally
exports.define = define;
exports.require = require;
expose(["tinymce/pasteplugin/Utils"]);
load('classes/Utils.js');
load('classes/SmartPaste.js');
load('classes/Clipboard.js');
load('classes/WordFilter.js');
load('classes/Quirks.js');
load('classes/Plugin.js');
writeScripts();
})(this);
// $hash: b44f5a1e3c57aa2f0306f05ae969c01f
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('preview', function(editor) {
var settings = editor.settings, sandbox = !tinymce.Env.ie;
editor.addCommand('mcePreview', function() {
editor.windowManager.open({
title: 'Preview',
width: parseInt(editor.getParam("plugin_preview_width", "650"), 10),
height: parseInt(editor.getParam("plugin_preview_height", "500"), 10),
html: '<iframe src="javascript:\'\'" frameborder="0"' + (sandbox ? ' sandbox="allow-scripts"' : '') + '></iframe>',
buttons: {
text: 'Close',
onclick: function() {
this.parent().parent().close();
}
},
onPostRender: function() {
var previewHtml, headHtml = '';
headHtml += '<base href="' + editor.documentBaseURI.getURI() + '">';
tinymce.each(editor.contentCSS, function(url) {
headHtml += '<link type="text/css" rel="stylesheet" href="' + editor.documentBaseURI.toAbsolute(url) + '">';
});
var bodyId = settings.body_id || 'tinymce';
if (bodyId.indexOf('=') != -1) {
bodyId = editor.getParam('body_id', '', 'hash');
bodyId = bodyId[editor.id] || bodyId;
}
var bodyClass = settings.body_class || '';
if (bodyClass.indexOf('=') != -1) {
bodyClass = editor.getParam('body_class', '', 'hash');
bodyClass = bodyClass[editor.id] || '';
}
var preventClicksOnLinksScript = (
'<script>' +
'document.addEventListener && document.addEventListener("click", function(e) {' +
'for (var elm = e.target; elm; elm = elm.parentNode) {' +
'if (elm.nodeName === "A") {' +
'e.preventDefault();' +
'}' +
'}' +
'}, false);' +
'</script> '
);
var dirAttr = editor.settings.directionality ? ' dir="' + editor.settings.directionality + '"' : '';
previewHtml = (
'<!DOCTYPE html>' +
'<html>' +
'<head>' +
headHtml +
'</head>' +
'<body id="' + bodyId + '" class="mce-content-body ' + bodyClass + '"' + dirAttr + '>' +
editor.getContent() +
preventClicksOnLinksScript +
'</body>' +
'</html>'
);
if (!sandbox) {
// IE 6-11 doesn't support data uris on iframes
// so I guess they will have to be less secure since we can't sandbox on those
// TODO: Use sandbox if future versions of IE supports iframes with data: uris.
var doc = this.getEl('body').firstChild.contentWindow.document;
doc.open();
doc.write(previewHtml);
doc.close();
} else {
this.getEl('body').firstChild.src = 'data:text/html;charset=utf-8,' + encodeURIComponent(previewHtml);
}
}
});
});
editor.addButton('preview', {
title: 'Preview',
cmd: 'mcePreview'
});
editor.addMenuItem('preview', {
text: 'Preview',
cmd: 'mcePreview',
context: 'view'
});
});
tinymce.PluginManager.add("preview",function(a){var b=a.settings,c=!tinymce.Env.ie;a.addCommand("mcePreview",function(){a.windowManager.open({title:"Preview",width:parseInt(a.getParam("plugin_preview_width","650"),10),height:parseInt(a.getParam("plugin_preview_height","500"),10),html:'<iframe src="javascript:\'\'" frameborder="0"'+(c?' sandbox="allow-scripts"':"")+"></iframe>",buttons:{text:"Close",onclick:function(){this.parent().parent().close()}},onPostRender:function(){var d,e="";e+='<base href="'+a.documentBaseURI.getURI()+'">',tinymce.each(a.contentCSS,function(b){e+='<link type="text/css" rel="stylesheet" href="'+a.documentBaseURI.toAbsolute(b)+'">'});var f=b.body_id||"tinymce";-1!=f.indexOf("=")&&(f=a.getParam("body_id","","hash"),f=f[a.id]||f);var g=b.body_class||"";-1!=g.indexOf("=")&&(g=a.getParam("body_class","","hash"),g=g[a.id]||"");var h='<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A") {e.preventDefault();}}}, false);</script> ',i=a.settings.directionality?' dir="'+a.settings.directionality+'"':"";if(d="<!DOCTYPE html><html><head>"+e+'</head><body id="'+f+'" class="mce-content-body '+g+'"'+i+">"+a.getContent()+h+"</body></html>",c)this.getEl("body").firstChild.src="data:text/html;charset=utf-8,"+encodeURIComponent(d);else{var j=this.getEl("body").firstChild.contentWindow.document;j.open(),j.write(d),j.close()}}})}),a.addButton("preview",{title:"Preview",cmd:"mcePreview"}),a.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})});
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('save', function(editor) {
function save() {
var formObj;
formObj = tinymce.DOM.getParent(editor.id, 'form');
if (editor.getParam("save_enablewhendirty", true) && !editor.isDirty()) {
return;
}
tinymce.triggerSave();
// Use callback instead
if (editor.getParam("save_onsavecallback")) {
editor.execCallback('save_onsavecallback', editor);
editor.nodeChanged();
return;
}
if (formObj) {
editor.setDirty(false);
if (!formObj.onsubmit || formObj.onsubmit()) {
if (typeof formObj.submit == "function") {
formObj.submit();
} else {
displayErrorMessage(editor.translate("Error: Form submit field collision."));
}
}
editor.nodeChanged();
} else {
displayErrorMessage(editor.translate("Error: No form element found."));
}
}
function displayErrorMessage(message) {
editor.notificationManager.open({
text: message,
type: 'error'
});
}
function cancel() {
var h = tinymce.trim(editor.startContent);
// Use callback instead
if (editor.getParam("save_oncancelcallback")) {
editor.execCallback('save_oncancelcallback', editor);
return;
}
editor.setContent(h);
editor.undoManager.clear();
editor.nodeChanged();
}
function stateToggle() {
var self = this;
editor.on('nodeChange dirty', function() {
self.disabled(editor.getParam("save_enablewhendirty", true) && !editor.isDirty());
});
}
editor.addCommand('mceSave', save);
editor.addCommand('mceCancel', cancel);
editor.addButton('save', {
icon: 'save',
text: 'Save',
cmd: 'mceSave',
disabled: true,
onPostRender: stateToggle
});
editor.addButton('cancel', {
text: 'Cancel',
icon: false,
cmd: 'mceCancel',
disabled: true,
onPostRender: stateToggle
});
editor.addShortcut('Meta+S', '', 'mceSave');
});
tinymce.PluginManager.add("save",function(a){function b(){var b;return b=tinymce.DOM.getParent(a.id,"form"),!a.getParam("save_enablewhendirty",!0)||a.isDirty()?(tinymce.triggerSave(),a.getParam("save_onsavecallback")?(a.execCallback("save_onsavecallback",a),void a.nodeChanged()):void(b?(a.setDirty(!1),b.onsubmit&&!b.onsubmit()||("function"==typeof b.submit?b.submit():c(a.translate("Error: Form submit field collision."))),a.nodeChanged()):c(a.translate("Error: No form element found.")))):void 0}function c(b){a.notificationManager.open({text:b,type:"error"})}function d(){var b=tinymce.trim(a.startContent);return a.getParam("save_oncancelcallback")?void a.execCallback("save_oncancelcallback",a):(a.setContent(b),a.undoManager.clear(),void a.nodeChanged())}function e(){var b=this;a.on("nodeChange dirty",function(){b.disabled(a.getParam("save_enablewhendirty",!0)&&!a.isDirty())})}a.addCommand("mceSave",b),a.addCommand("mceCancel",d),a.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:e}),a.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:e}),a.addShortcut("Meta+S","","mceSave")});
\ No newline at end of file
!function(){function a(a){return a&&1==a.nodeType&&"false"===a.contentEditable}function b(b,c,d,e,f){function g(a,b){if(b=b||0,!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";var c=a.index;if(b>0){var d=a[b];if(!d)throw"Invalid capture group";c+=a[0].indexOf(d),a[0]=d}return[c,c+a[0].length,[a[0]]]}function h(b){var c;if(3===b.nodeType)return b.data;if(o[b.nodeName]&&!n[b.nodeName])return"";if(c="",a(b))return"\n";if((n[b.nodeName]||p[b.nodeName])&&(c+="\n"),b=b.firstChild)do c+=h(b);while(b=b.nextSibling);return c}function i(b,c,d){var e,f,g,h,i=[],j=0,k=b,l=c.shift(),m=0;a:for(;;){if((n[k.nodeName]||p[k.nodeName]||a(k))&&j++,3===k.nodeType&&(!f&&k.length+j>=l[1]?(f=k,h=l[1]-j):e&&i.push(k),!e&&k.length+j>l[0]&&(e=k,g=l[0]-j),j+=k.length),e&&f){if(k=d({startNode:e,startNodeIndex:g,endNode:f,endNodeIndex:h,innerNodes:i,match:l[2],matchIndex:m}),j-=f.length-h,e=null,f=null,i=[],l=c.shift(),m++,!l)break}else if(o[k.nodeName]&&!n[k.nodeName]||!k.firstChild){if(k.nextSibling){k=k.nextSibling;continue}}else if(!a(k)){k=k.firstChild;continue}for(;;){if(k.nextSibling){k=k.nextSibling;break}if(k.parentNode===b)break a;k=k.parentNode}}}function j(a){var b;if("function"!=typeof a){var c=a.nodeType?a:m.createElement(a);b=function(a,b){var d=c.cloneNode(!1);return d.setAttribute("data-mce-index",b),a&&d.appendChild(m.createTextNode(a)),d}}else b=a;return function(a){var c,d,e,f=a.startNode,g=a.endNode,h=a.matchIndex;if(f===g){var i=f;e=i.parentNode,a.startNodeIndex>0&&(c=m.createTextNode(i.data.substring(0,a.startNodeIndex)),e.insertBefore(c,i));var j=b(a.match[0],h);return e.insertBefore(j,i),a.endNodeIndex<i.length&&(d=m.createTextNode(i.data.substring(a.endNodeIndex)),e.insertBefore(d,i)),i.parentNode.removeChild(i),j}c=m.createTextNode(f.data.substring(0,a.startNodeIndex)),d=m.createTextNode(g.data.substring(a.endNodeIndex));for(var k=b(f.data.substring(a.startNodeIndex),h),l=[],n=0,o=a.innerNodes.length;o>n;++n){var p=a.innerNodes[n],q=b(p.data,h);p.parentNode.replaceChild(q,p),l.push(q)}var r=b(g.data.substring(0,a.endNodeIndex),h);return e=f.parentNode,e.insertBefore(c,f),e.insertBefore(k,f),e.removeChild(f),e=g.parentNode,e.insertBefore(r,g),e.insertBefore(d,g),e.removeChild(g),r}}var k,l,m,n,o,p,q=[],r=0;if(m=c.ownerDocument,n=f.getBlockElements(),o=f.getWhiteSpaceElements(),p=f.getShortEndedElements(),l=h(c)){if(b.global)for(;k=b.exec(l);)q.push(g(k,e));else k=l.match(b),q.push(g(k,e));return q.length&&(r=q.length,i(c,q,j(d))),r}}function c(a){function c(){function b(){f.statusbar.find("#next").disabled(!g(l+1).length),f.statusbar.find("#prev").disabled(!g(l-1).length)}function c(){a.windowManager.alert("Could not find the specified string.",function(){f.find("#find")[0].focus()})}var d,e={};d=tinymce.trim(a.selection.getContent({format:"text"}));var f=a.windowManager.open({layout:"flex",pack:"center",align:"center",onClose:function(){a.focus(),k.done()},onSubmit:function(a){var d,h,i,j;return a.preventDefault(),h=f.find("#case").checked(),j=f.find("#words").checked(),i=f.find("#find").value(),i.length?e.text==i&&e.caseState==h&&e.wholeWord==j?0===g(l+1).length?void c():(k.next(),void b()):(d=k.find(i,h,j),d||c(),f.statusbar.items().slice(1).disabled(0===d),b(),void(e={text:i,caseState:h,wholeWord:j})):(k.done(!1),void f.statusbar.items().slice(1).disabled(!0))},buttons:[{text:"Find",subtype:"primary",onclick:function(){f.submit()}},{text:"Replace",disabled:!0,onclick:function(){k.replace(f.find("#replace").value())||(f.statusbar.items().slice(1).disabled(!0),l=-1,e={})}},{text:"Replace all",disabled:!0,onclick:function(){k.replace(f.find("#replace").value(),!0,!0),f.statusbar.items().slice(1).disabled(!0),e={}}},{type:"spacer",flex:1},{text:"Prev",name:"prev",disabled:!0,onclick:function(){k.prev(),b()}},{text:"Next",name:"next",disabled:!0,onclick:function(){k.next(),b()}}],title:"Find and replace",items:{type:"form",padding:20,labelGap:30,spacing:10,items:[{type:"textbox",name:"find",size:40,label:"Find",value:d},{type:"textbox",name:"replace",size:40,label:"Replace with"},{type:"checkbox",name:"case",text:"Match case",label:" "},{type:"checkbox",name:"words",text:"Whole words",label:" "}]}})}function d(a){var b=a.getAttribute("data-mce-index");return"number"==typeof b?""+b:b}function e(c){var d,e;return e=a.dom.create("span",{"data-mce-bogus":1}),e.className="mce-match-marker",d=a.getBody(),k.done(!1),b(c,d,e,!1,a.schema)}function f(a){var b=a.parentNode;a.firstChild&&b.insertBefore(a.firstChild,a),a.parentNode.removeChild(a)}function g(b){var c,e=[];if(c=tinymce.toArray(a.getBody().getElementsByTagName("span")),c.length)for(var f=0;f<c.length;f++){var g=d(c[f]);null!==g&&g.length&&g===b.toString()&&e.push(c[f])}return e}function h(b){var c=l,d=a.dom;b=b!==!1,b?c++:c--,d.removeClass(g(l),"mce-match-marker-selected");var e=g(c);return e.length?(d.addClass(g(c),"mce-match-marker-selected"),a.selection.scrollIntoView(e[0]),c):-1}function i(b){var c=a.dom,d=b.parentNode;c.remove(b),c.isEmpty(d)&&c.remove(d)}function j(a){var b=d(a);return null!==b&&b.length>0}var k=this,l=-1;k.init=function(a){a.addMenuItem("searchreplace",{text:"Find and replace",shortcut:"Meta+F",onclick:c,separator:"before",context:"edit"}),a.addButton("searchreplace",{tooltip:"Find and replace",shortcut:"Meta+F",onclick:c}),a.addCommand("SearchReplace",c),a.shortcuts.add("Meta+F","",c)},k.find=function(a,b,c){a=a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),a=c?"\\b"+a+"\\b":a;var d=e(new RegExp(a,b?"g":"gi"));return d&&(l=-1,l=h(!0)),d},k.next=function(){var a=h(!0);-1!==a&&(l=a)},k.prev=function(){var a=h(!1);-1!==a&&(l=a)},k.replace=function(b,c,e){var h,m,n,o,p,q,r=l;for(c=c!==!1,n=a.getBody(),m=tinymce.grep(tinymce.toArray(n.getElementsByTagName("span")),j),h=0;h<m.length;h++){var s=d(m[h]);if(o=p=parseInt(s,10),e||o===l){for(b.length?(m[h].firstChild.nodeValue=b,f(m[h])):i(m[h]);m[++h];){if(o=parseInt(d(m[h]),10),o!==p){h--;break}i(m[h])}c&&r--}else p>l&&m[h].setAttribute("data-mce-index",p-1)}return a.undoManager.add(),l=r,c?(q=g(r+1).length>0,k.next()):(q=g(r-1).length>0,k.prev()),!e&&q},k.done=function(b){var c,e,g,h;for(e=tinymce.toArray(a.getBody().getElementsByTagName("span")),c=0;c<e.length;c++){var i=d(e[c]);null!==i&&i.length&&(i===l.toString()&&(g||(g=e[c].firstChild),h=e[c].firstChild),f(e[c]))}if(g&&h){var j=a.dom.createRng();return j.setStart(g,0),j.setEnd(h,h.data.length),b!==!1&&a.selection.setRng(j),j}}}tinymce.PluginManager.add("searchreplace",c)}();
\ No newline at end of file
/**
* Inline development version. Only to be used while developing since it uses document.write to load scripts.
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports) {
"use strict";
var html = "", baseDir;
var modules = {}, exposedModules = [], moduleCount = 0;
var scripts = document.getElementsByTagName('script');
for (var i = 0; i < scripts.length; i++) {
var src = scripts[i].src;
if (src.indexOf('/plugin.dev.js') != -1) {
baseDir = src.substring(0, src.lastIndexOf('/'));
}
}
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function resolve(id) {
if (exports.privateModules && id in exports.privateModules) {
return;
}
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function register(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
function define(id, dependencies, definition) {
var privateModules, i;
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
if (--moduleCount === 0) {
for (i = 0; i < exposedModules.length; i++) {
register(exposedModules[i]);
}
}
// Expose private modules for unit tests
if (exports.AMDLC_TESTS) {
privateModules = exports.privateModules || {};
for (id in modules) {
privateModules[id] = modules[id];
}
for (i = 0; i < exposedModules.length; i++) {
delete privateModules[exposedModules[i]];
}
exports.privateModules = privateModules;
}
}
function expose(ids) {
exposedModules = ids;
}
function writeScripts() {
document.write(html);
}
function load(path) {
html += '<script type="text/javascript" src="' + baseDir + '/' + path + '"></script>\n';
moduleCount++;
}
// Expose globally
exports.define = define;
exports.require = require;
expose(["tinymce/spellcheckerplugin/DomTextMatcher"]);
load('classes/DomTextMatcher.js');
load('classes/Plugin.js');
writeScripts();
})(this);
// $hash: a894b80e97e733310c550dadb509e87a
\ No newline at end of file
!function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;f<a.length;++f){if(c=g[a[f]]||e(a[f]),!c)throw"module definition dependecy not found: "+a[f];d.push(c)}b.apply(null,d)}function d(a,d,e){if("string"!=typeof a)throw"invalid module definition, module id must be defined and be a string";if(d===b)throw"invalid module definition, dependencies must be specified";if(e===b)throw"invalid module definition, definition function must be specified";c(d,function(){g[a]=e.apply(null,arguments)})}function e(b){for(var c=a,d=b.split(/[.\/]/),e=0;e<d.length;++e){if(!c[d[e]])return;c=c[d[e]]}return c}function f(c){var d,e,f,h,i;for(d=0;d<c.length;d++){e=a,f=c[d],h=f.split(/[.\/]/);for(var j=0;j<h.length-1;++j)e[h[j]]===b&&(e[h[j]]={}),e=e[h[j]];e[h[h.length-1]]=g[f]}if(a.AMDLC_TESTS){i=a.privateModules||{};for(f in g)i[f]=g[f];for(d=0;d<c.length;d++)delete i[c[d]];a.privateModules=i}}var g={};d("tinymce/spellcheckerplugin/DomTextMatcher",[],function(){function a(a){return a&&1==a.nodeType&&"false"===a.contentEditable}return function(b,c){function d(a,b){if(!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";return{start:a.index,end:a.index+a[0].length,text:a[0],data:b}}function e(b){var c;if(3===b.nodeType)return b.data;if(y[b.nodeName]&&!x[b.nodeName])return"";if(a(b))return"\n";if(c="",(x[b.nodeName]||z[b.nodeName])&&(c+="\n"),b=b.firstChild)do c+=e(b);while(b=b.nextSibling);return c}function f(b,c,d){var e,f,g,h,i,j=[],k=0,l=b,m=0;c=c.slice(0),c.sort(function(a,b){return a.start-b.start}),i=c.shift();a:for(;;){if((x[l.nodeName]||z[l.nodeName]||a(l))&&k++,3===l.nodeType&&(!f&&l.length+k>=i.end?(f=l,h=i.end-k):e&&j.push(l),!e&&l.length+k>i.start&&(e=l,g=i.start-k),k+=l.length),e&&f){if(l=d({startNode:e,startNodeIndex:g,endNode:f,endNodeIndex:h,innerNodes:j,match:i.text,matchIndex:m}),k-=f.length-h,e=null,f=null,j=[],i=c.shift(),m++,!i)break}else if(y[l.nodeName]&&!x[l.nodeName]||!l.firstChild){if(l.nextSibling){l=l.nextSibling;continue}}else if(!a(l)){l=l.firstChild;continue}for(;;){if(l.nextSibling){l=l.nextSibling;break}if(l.parentNode===b)break a;l=l.parentNode}}}function g(a){function b(b,c){var d=A[c];d.stencil||(d.stencil=a(d));var e=d.stencil.cloneNode(!1);return e.setAttribute("data-mce-index",c),b&&e.appendChild(B.doc.createTextNode(b)),e}return function(a){var c,d,e,f=a.startNode,g=a.endNode,h=a.matchIndex,i=B.doc;if(f===g){var j=f;e=j.parentNode,a.startNodeIndex>0&&(c=i.createTextNode(j.data.substring(0,a.startNodeIndex)),e.insertBefore(c,j));var k=b(a.match,h);return e.insertBefore(k,j),a.endNodeIndex<j.length&&(d=i.createTextNode(j.data.substring(a.endNodeIndex)),e.insertBefore(d,j)),j.parentNode.removeChild(j),k}c=i.createTextNode(f.data.substring(0,a.startNodeIndex)),d=i.createTextNode(g.data.substring(a.endNodeIndex));for(var l=b(f.data.substring(a.startNodeIndex),h),m=[],n=0,o=a.innerNodes.length;o>n;++n){var p=a.innerNodes[n],q=b(p.data,h);p.parentNode.replaceChild(q,p),m.push(q)}var r=b(g.data.substring(0,a.endNodeIndex),h);return e=f.parentNode,e.insertBefore(c,f),e.insertBefore(l,f),e.removeChild(f),e=g.parentNode,e.insertBefore(r,g),e.insertBefore(d,g),e.removeChild(g),r}}function h(a){var b=a.parentNode;b.insertBefore(a.firstChild,a),a.parentNode.removeChild(a)}function i(a){var c=b.getElementsByTagName("*"),d=[];a="number"==typeof a?""+a:null;for(var e=0;e<c.length;e++){var f=c[e],g=f.getAttribute("data-mce-index");null!==g&&g.length&&(g!==a&&null!==a||d.push(f))}return d}function j(a){for(var b=A.length;b--;)if(A[b]===a)return b;return-1}function k(a){var b=[];return l(function(c,d){a(c,d)&&b.push(c)}),A=b,this}function l(a){for(var b=0,c=A.length;c>b&&a(A[b],b)!==!1;b++);return this}function m(a){return A.length&&f(b,A,g(a)),this}function n(a,b){if(w&&a.global)for(;v=a.exec(w);)A.push(d(v,b));return this}function o(a){var b,c=i(a?j(a):null);for(b=c.length;b--;)h(c[b]);return this}function p(a){return A[a.getAttribute("data-mce-index")]}function q(a){return i(j(a))[0]}function r(a,b,c){return A.push({start:a,end:a+b,text:w.substr(a,b),data:c}),this}function s(a){var b=i(j(a)),d=c.dom.createRng();return d.setStartBefore(b[0]),d.setEndAfter(b[b.length-1]),d}function t(a,b){var d=s(a);return d.deleteContents(),b.length>0&&d.insertNode(c.dom.doc.createTextNode(b)),d}function u(){return A.splice(0,A.length),o(),this}var v,w,x,y,z,A=[],B=c.dom;return x=c.schema.getBlockElements(),y=c.schema.getWhiteSpaceElements(),z=c.schema.getShortEndedElements(),w=e(b),{text:w,matches:A,each:l,filter:k,reset:u,matchFromElement:p,elementFromMatch:q,find:n,add:r,wrap:m,unwrap:o,replace:t,rangeFromMatch:s,indexOf:j}}}),d("tinymce/spellcheckerplugin/Plugin",["tinymce/spellcheckerplugin/DomTextMatcher","tinymce/PluginManager","tinymce/util/Tools","tinymce/ui/Menu","tinymce/dom/DOMUtils","tinymce/util/XHR","tinymce/util/URI","tinymce/util/JSON"],function(a,b,c,d,e,f,g,h){b.add("spellchecker",function(i,j){function k(){return F.textMatcher||(F.textMatcher=new a(i.getBody(),i)),F.textMatcher}function l(a,b){var d=[];return c.each(b,function(a){d.push({selectable:!0,text:a.name,data:a.value})}),d}function m(a){for(var b in a)return!1;return!0}function n(a,b){var f=[],g=B[a];c.each(g,function(a){f.push({text:a,onclick:function(){i.insertContent(i.dom.encode(a)),i.dom.remove(b),s()}})}),f.push({text:"-"}),E&&f.push({text:"Add to Dictionary",onclick:function(){t(a,b)}}),f.push.apply(f,[{text:"Ignore",onclick:function(){u(a,b)}},{text:"Ignore all",onclick:function(){u(a,b,!0)}}]),D=new d({items:f,context:"contextmenu",onautohide:function(a){-1!=a.target.className.indexOf("spellchecker")&&a.preventDefault()},onhide:function(){D.remove(),D=null}}),D.renderTo(document.body);var h=e.DOM.getPos(i.getContentAreaContainer()),j=i.dom.getPos(b[0]),k=i.dom.getRoot();"BODY"==k.nodeName?(j.x-=k.ownerDocument.documentElement.scrollLeft||k.scrollLeft,j.y-=k.ownerDocument.documentElement.scrollTop||k.scrollTop):(j.x-=k.scrollLeft,j.y-=k.scrollTop),h.x+=j.x,h.y+=j.y,D.moveTo(h.x,h.y+b[0].offsetHeight)}function o(){return i.getParam("spellchecker_wordchar_pattern")||new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`\xa7\xa9\xab\xae\xb1\xb6\xb7\xb8\xbb\xbc\xbd\xbe\xbf\xd7\xf7\xa4\u201d\u201c\u201e\xa0\u2002\u2003\u2009]+',"g")}function p(a,b,d,e){var k={method:a,lang:G.spellchecker_language},l="";k["addToDictionary"==a?"word":"text"]=b,c.each(k,function(a,b){l&&(l+="&"),l+=b+"="+encodeURIComponent(a)}),f.send({url:new g(j).toAbsolute(G.spellchecker_rpc_url),type:"post",content_type:"application/x-www-form-urlencoded",data:l,success:function(a){if(a=h.parse(a))a.error?e(a.error):d(a);else{var b=i.translate("Server response wasn't proper JSON.");e(b)}},error:function(){var a=i.translate("The spelling service was not found: (")+G.spellchecker_rpc_url+i.translate(")");e(a)}})}function q(a,b,c,d){var e=G.spellchecker_callback||p;e.call(F,a,b,c,d)}function r(){function a(a){i.notificationManager.open({text:a,type:"error"}),i.setProgressState(!1),v()}v()||(i.setProgressState(!0),q("spellcheck",k().text,z,a),i.focus())}function s(){i.dom.select("span.mce-spellchecker-word").length||v()}function t(a,b){i.setProgressState(!0),q("addToDictionary",a,function(){i.setProgressState(!1),i.dom.remove(b,!0),s()},function(a){i.notificationManager.open({text:a,type:"error"}),i.setProgressState(!1)})}function u(a,b,d){i.selection.collapse(),d?c.each(i.dom.select("span.mce-spellchecker-word"),function(b){b.getAttribute("data-mce-word")==a&&i.dom.remove(b,!0)}):i.dom.remove(b,!0),s()}function v(){return k().reset(),F.textMatcher=null,C?(C=!1,i.fire("SpellcheckEnd"),!0):void 0}function w(a){var b=a.getAttribute("data-mce-index");return"number"==typeof b?""+b:b}function x(a){var b,d=[];if(b=c.toArray(i.getBody().getElementsByTagName("span")),b.length)for(var e=0;e<b.length;e++){var f=w(b[e]);null!==f&&f.length&&f===a.toString()&&d.push(b[e])}return d}function y(a){var b=G.spellchecker_language;a.control.items().each(function(a){a.active(a.settings.data===b)})}function z(a){var b;if(a.words?(E=!!a.dictionary,b=a.words):b=a,i.setProgressState(!1),m(b)){var c=i.translate("No misspellings found.");return i.notificationManager.open({text:c,type:"info"}),void(C=!1)}B=b,k().find(o()).filter(function(a){return!!b[a.text]}).wrap(function(a){return i.dom.create("span",{"class":"mce-spellchecker-word","data-mce-bogus":1,"data-mce-word":a.text})}),C=!0,i.fire("SpellcheckStart")}var A,B,C,D,E,F=this,G=i.settings;if(/(^|[ ,])tinymcespellchecker([, ]|$)/.test(G.plugins)&&b.get("tinymcespellchecker"))return void("undefined"!=typeof console&&console.log&&console.log("Spell Checker Pro is incompatible with Spell Checker plugin! Remove 'spellchecker' from the 'plugins' option."));var H=G.spellchecker_languages||"English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,German=de,Italian=it,Polish=pl,Portuguese=pt_BR,Spanish=es,Swedish=sv";A=l("Language",c.map(H.split(","),function(a){return a=a.split("="),{name:a[0],value:a[1]}})),i.on("click",function(a){var b=a.target;if("mce-spellchecker-word"==b.className){a.preventDefault();var c=x(w(b));if(c.length>0){var d=i.dom.createRng();d.setStartBefore(c[0]),d.setEndAfter(c[c.length-1]),i.selection.setRng(d),n(b.getAttribute("data-mce-word"),c)}}}),i.addMenuItem("spellchecker",{text:"Spellcheck",context:"tools",onclick:r,selectable:!0,onPostRender:function(){var a=this;a.active(C),i.on("SpellcheckStart SpellcheckEnd",function(){a.active(C)})}});var I={tooltip:"Spellcheck",onclick:r,onPostRender:function(){var a=this;i.on("SpellcheckStart SpellcheckEnd",function(){a.active(C)})}};A.length>1&&(I.type="splitbutton",I.menu=A,I.onshow=y,I.onselect=function(a){G.spellchecker_language=a.control.settings.data}),i.addButton("spellchecker",I),i.addCommand("mceSpellCheck",r),i.on("remove",function(){D&&(D.remove(),D=null)}),i.on("change",s),this.getTextMatcher=k,this.getWordCharPattern=o,this.markErrors=z,this.getLanguage=function(){return G.spellchecker_language},G.spellchecker_language=G.spellchecker_language||G.language||"en"})}),f(["tinymce/spellcheckerplugin/DomTextMatcher"])}(this);
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('tabfocus', function(editor) {
var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
function tabCancel(e) {
if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
e.preventDefault();
}
}
function tabHandler(e) {
var x, el, v, i;
if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
return;
}
function find(direction) {
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
function canSelectRecursive(e) {
return e.nodeName === "BODY" || (e.type != 'hidden' &&
e.style.display != "none" &&
e.style.visibility != "hidden" && canSelectRecursive(e.parentNode));
}
function canSelect(el) {
return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && tinymce.get(e.id) && el.tabIndex != -1 && canSelectRecursive(el);
}
each(el, function(e, i) {
if (e.id == editor.id) {
x = i;
return false;
}
});
if (direction > 0) {
for (i = x + 1; i < el.length; i++) {
if (canSelect(el[i])) {
return el[i];
}
}
} else {
for (i = x - 1; i >= 0; i--) {
if (canSelect(el[i])) {
return el[i];
}
}
}
return null;
}
v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
if (v.length == 1) {
v[1] = v[0];
v[0] = ':prev';
}
// Find element to focus
if (e.shiftKey) {
if (v[0] == ':prev') {
el = find(-1);
} else {
el = DOM.get(v[0]);
}
} else {
if (v[1] == ':next') {
el = find(1);
} else {
el = DOM.get(v[1]);
}
}
if (el) {
var focusEditor = tinymce.get(el.id || el.name);
if (el.id && focusEditor) {
focusEditor.focus();
} else {
tinymce.util.Delay.setTimeout(function() {
if (!tinymce.Env.webkit) {
window.focus();
}
el.focus();
}, 10);
}
e.preventDefault();
}
}
editor.on('init', function() {
if (editor.inline) {
// Remove default tabIndex in inline mode
tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null);
}
editor.on('keyup', tabCancel);
if (tinymce.Env.gecko) {
editor.on('keypress keydown', tabHandler);
} else {
editor.on('keydown', tabHandler);
}
});
});
tinymce.PluginManager.add("tabfocus",function(a){function b(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function c(b){function c(c){function f(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&f(a.parentNode)}function i(a){return/INPUT|TEXTAREA|BUTTON/.test(a.tagName)&&tinymce.get(b.id)&&-1!=a.tabIndex&&f(a)}if(h=d.select(":input:enabled,*[tabindex]:not(iframe)"),e(h,function(b,c){return b.id==a.id?(g=c,!1):void 0}),c>0){for(j=g+1;j<h.length;j++)if(i(h[j]))return h[j]}else for(j=g-1;j>=0;j--)if(i(h[j]))return h[j];return null}var g,h,i,j;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey||b.isDefaultPrevented())&&(i=f(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==i.length&&(i[1]=i[0],i[0]=":prev"),h=b.shiftKey?":prev"==i[0]?c(-1):d.get(i[0]):":next"==i[1]?c(1):d.get(i[1]))){var k=tinymce.get(h.id||h.name);h.id&&k?k.focus():tinymce.util.Delay.setTimeout(function(){tinymce.Env.webkit||window.focus(),h.focus()},10),b.preventDefault()}}var d=tinymce.DOM,e=tinymce.each,f=tinymce.explode;a.on("init",function(){a.inline&&tinymce.DOM.setAttrib(a.getBody(),"tabIndex",null),a.on("keyup",b),tinymce.Env.gecko?a.on("keypress keydown",c):a.on("keydown",c)})});
\ No newline at end of file
/**
* CellSelection.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* This class handles table cell selection by faking it using a css class that gets applied
* to cells when dragging the mouse from one cell to another.
*
* @class tinymce.tableplugin.CellSelection
* @private
*/
define("tinymce/tableplugin/CellSelection", [
"tinymce/tableplugin/TableGrid",
"tinymce/dom/TreeWalker",
"tinymce/util/Tools"
], function(TableGrid, TreeWalker, Tools) {
return function(editor, selectionChange) {
var dom = editor.dom, tableGrid, startCell, startTable, lastMouseOverTarget, hasCellSelection = true, resizing, dragging;
function clear(force) {
// Restore selection possibilities
editor.getBody().style.webkitUserSelect = '';
if (force || hasCellSelection) {
editor.$('td[data-mce-selected],th[data-mce-selected]').removeAttr('data-mce-selected');
hasCellSelection = false;
}
}
var endSelection = function () {
startCell = tableGrid = startTable = lastMouseOverTarget = null;
selectionChange(false);
};
function isCellInTable(table, cell) {
if (!table || !cell) {
return false;
}
return table === dom.getParent(cell, 'table');
}
function cellSelectionHandler(e) {
var sel, target = e.target, currentCell;
if (resizing || dragging) {
return;
}
// Fake mouse enter by keeping track of last mouse over
if (target === lastMouseOverTarget) {
return;
}
lastMouseOverTarget = target;
if (startTable && startCell) {
currentCell = dom.getParent(target, 'td,th');
if (!isCellInTable(startTable, currentCell)) {
currentCell = dom.getParent(startTable, 'td,th');
}
// Selection inside first cell is normal until we have expanted
if (startCell === currentCell && !hasCellSelection) {
return;
}
selectionChange(true);
if (isCellInTable(startTable, currentCell)) {
e.preventDefault();
if (!tableGrid) {
tableGrid = new TableGrid(editor, startTable, startCell);
editor.getBody().style.webkitUserSelect = 'none';
}
tableGrid.setEndCell(currentCell);
hasCellSelection = true;
// Remove current selection
sel = editor.selection.getSel();
try {
if (sel.removeAllRanges) {
sel.removeAllRanges();
} else {
sel.empty();
}
} catch (ex) {
// IE9 might throw errors here
}
}
}
}
editor.on('SelectionChange', function(e) {
if (hasCellSelection) {
e.stopImmediatePropagation();
}
}, true);
// Add cell selection logic
editor.on('MouseDown', function(e) {
if (e.button != 2 && !resizing && !dragging) {
clear();
startCell = dom.getParent(e.target, 'td,th');
startTable = dom.getParent(startCell, 'table');
}
});
editor.on('mouseover', cellSelectionHandler);
editor.on('remove', function() {
dom.unbind(editor.getDoc(), 'mouseover', cellSelectionHandler);
clear();
});
editor.on('MouseUp', function() {
var rng, sel = editor.selection, selectedCells, walker, node, lastNode;
function setPoint(node, start) {
var walker = new TreeWalker(node, node);
do {
// Text node
if (node.nodeType == 3 && Tools.trim(node.nodeValue).length !== 0) {
if (start) {
rng.setStart(node, 0);
} else {
rng.setEnd(node, node.nodeValue.length);
}
return;
}
// BR element
if (node.nodeName == 'BR') {
if (start) {
rng.setStartBefore(node);
} else {
rng.setEndBefore(node);
}
return;
}
} while ((node = (start ? walker.next() : walker.prev())));
}
// Move selection to startCell
if (startCell) {
if (tableGrid) {
editor.getBody().style.webkitUserSelect = '';
}
// Try to expand text selection as much as we can only Gecko supports cell selection
selectedCells = dom.select('td[data-mce-selected],th[data-mce-selected]');
if (selectedCells.length > 0) {
rng = dom.createRng();
node = selectedCells[0];
rng.setStartBefore(node);
rng.setEndAfter(node);
setPoint(node, 1);
walker = new TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
do {
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
if (!dom.getAttrib(node, 'data-mce-selected')) {
break;
}
lastNode = node;
}
} while ((node = walker.next()));
setPoint(lastNode);
sel.setRng(rng);
}
editor.nodeChanged();
endSelection();
}
});
editor.on('KeyUp Drop SetContent', function(e) {
clear(e.type == 'setcontent');
endSelection();
resizing = false;
});
editor.on('ObjectResizeStart ObjectResized', function(e) {
resizing = e.type != 'objectresized';
});
editor.on('dragstart', function () {
dragging = true;
});
editor.on('drop dragend', function () {
dragging = false;
});
return {
clear: clear
};
};
});
/**
* SplitCols.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* Contains logic for handling splitting of merged rows.
*
* @class tinymce.tableplugin.SplitCols
* @private
*/
define("tinymce/tableplugin/SplitCols", [
"tinymce/util/Tools",
"tinymce/tableplugin/Utils"
], function(Tools, Utils) {
var getCellAt = function (grid, x, y) {
return grid[y] ? grid[y][x] : null;
};
var getCellElmAt = function (grid, x, y) {
var cell = getCellAt(grid, x, y);
return cell ? cell.elm : null;
};
var countHoles = function (grid, x, y, delta) {
var y2, cell, count = 0, elm = getCellElmAt(grid, x, y);
for (y2 = y; delta > 0 ? y2 < grid.length : y2 >= 0; y2 += delta) {
cell = getCellAt(grid, x, y2);
if (elm !== cell.elm) {
break;
}
count++;
}
return count;
};
var findRealElm = function (grid, x, y) {
var cell, row = grid[y];
for (var x2 = x; x2 < row.length; x2++) {
cell = row[x2];
if (cell.real) {
return cell.elm;
}
}
return null;
};
var getRowSplitInfo = function (grid, y) {
var cell, result = [], row = grid[y];
for (var x = 0; x < row.length; x++) {
cell = row[x];
result.push({
elm: cell.elm,
above: countHoles(grid, x, y, -1) - 1,
below: countHoles(grid, x, y, 1) - 1
});
x += Utils.getColSpan(cell.elm) - 1;
}
return result;
};
var createCell = function (info, rowSpan) {
var doc = info.elm.ownerDocument;
var newCell = doc.createElement('td');
Utils.setColSpan(newCell, Utils.getColSpan(info.elm));
Utils.setRowSpan(newCell, rowSpan);
Utils.paddCell(newCell);
return newCell;
};
var insertOrAppendCell = function (grid, newCell, x, y) {
var realCellElm = findRealElm(grid, x + 1, y);
if (!realCellElm) {
realCellElm = findRealElm(grid, 0, y);
realCellElm.parentNode.appendChild(newCell);
} else {
realCellElm.parentNode.insertBefore(newCell, realCellElm);
}
};
var splitAbove = function (grid, info, x, y) {
if (info.above !== 0) {
Utils.setRowSpan(info.elm, info.above);
var cell = createCell(info, info.below + 1);
insertOrAppendCell(grid, cell, x, y);
return cell;
}
return null;
};
var splitBelow = function (grid, info, x, y) {
if (info.below !== 0) {
Utils.setRowSpan(info.elm, info.above + 1);
var cell = createCell(info, info.below);
insertOrAppendCell(grid, cell, x, y + 1);
return cell;
}
return null;
};
var splitAt = function (grid, x, y, before) {
var rowInfos = getRowSplitInfo(grid, y);
var rowElm = getCellElmAt(grid, x, y).parentNode;
var cells = [];
Tools.each(rowInfos, function (info, x) {
var cell = before ? splitAbove(grid, info, x, y) : splitBelow(grid, info, x, y);
if (cell !== null) {
cells.push(cells);
}
});
return {
cells: cells,
row: rowElm
};
};
return {
splitAt: splitAt
};
});
/**
* Utils.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* Various utility functions.
*
* @class tinymce.tableplugin.Utils
* @private
*/
define("tinymce/tableplugin/Utils", [
"tinymce/Env"
], function(Env) {
var setSpanVal = function (name) {
return function (td, val) {
if (td) {
val = parseInt(val, 10);
if (val === 1 || val === 0) {
td.removeAttribute(name, 1);
} else {
td.setAttribute(name, val, 1);
}
}
};
};
var getSpanVal = function (name) {
return function (td) {
return parseInt(td.getAttribute(name) || 1, 10);
};
};
function paddCell(cell) {
if (!Env.ie || Env.ie > 9) {
if (!cell.hasChildNodes()) {
cell.innerHTML = '<br data-mce-bogus="1" />';
}
}
}
return {
setColSpan: setSpanVal('colSpan'),
setRowSpan: setSpanVal('rowspan'),
getColSpan: getSpanVal('colSpan'),
getRowSpan: getSpanVal('rowSpan'),
setSpanVal: function (td, name, value) {
setSpanVal(name)(td, value);
},
getSpanVal: function (td, name) {
return getSpanVal(name)(td);
},
paddCell: paddCell
};
});
/**
* Inline development version. Only to be used while developing since it uses document.write to load scripts.
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports) {
"use strict";
var html = "", baseDir;
var modules = {}, exposedModules = [], moduleCount = 0;
var scripts = document.getElementsByTagName('script');
for (var i = 0; i < scripts.length; i++) {
var src = scripts[i].src;
if (src.indexOf('/plugin.dev.js') != -1) {
baseDir = src.substring(0, src.lastIndexOf('/'));
}
}
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function resolve(id) {
if (exports.privateModules && id in exports.privateModules) {
return;
}
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function register(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
function define(id, dependencies, definition) {
var privateModules, i;
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
if (--moduleCount === 0) {
for (i = 0; i < exposedModules.length; i++) {
register(exposedModules[i]);
}
}
// Expose private modules for unit tests
if (exports.AMDLC_TESTS) {
privateModules = exports.privateModules || {};
for (id in modules) {
privateModules[id] = modules[id];
}
for (i = 0; i < exposedModules.length; i++) {
delete privateModules[exposedModules[i]];
}
exports.privateModules = privateModules;
}
}
function expose(ids) {
exposedModules = ids;
}
function writeScripts() {
document.write(html);
}
function load(path) {
html += '<script type="text/javascript" src="' + baseDir + '/' + path + '"></script>\n';
moduleCount++;
}
// Expose globally
exports.define = define;
exports.require = require;
load('classes/Utils.js');
load('classes/SplitCols.js');
load('classes/TableGrid.js');
load('classes/Quirks.js');
load('classes/CellSelection.js');
load('classes/Dialogs.js');
load('classes/ResizeBars.js');
load('classes/Plugin.js');
writeScripts();
})(this);
// $hash: 0b5b0a5cbb1bb45bfd79c5a1388e01ff
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('template', function(editor) {
var each = tinymce.each;
function createTemplateList(callback) {
return function() {
var templateList = editor.settings.templates;
if (typeof templateList == "function") {
templateList(callback);
return;
}
if (typeof templateList == "string") {
tinymce.util.XHR.send({
url: templateList,
success: function(text) {
callback(tinymce.util.JSON.parse(text));
}
});
} else {
callback(templateList);
}
};
}
function showDialog(templateList) {
var win, values = [], templateHtml;
if (!templateList || templateList.length === 0) {
var message = editor.translate('No templates defined.');
editor.notificationManager.open({text: message, type: 'info'});
return;
}
tinymce.each(templateList, function(template) {
values.push({
selected: !values.length,
text: template.title,
value: {
url: template.url,
content: template.content,
description: template.description
}
});
});
function onSelectTemplate(e) {
var value = e.control.value();
function insertIframeHtml(html) {
if (html.indexOf('<html>') == -1) {
var contentCssLinks = '';
tinymce.each(editor.contentCSS, function(url) {
contentCssLinks += '<link type="text/css" rel="stylesheet" href="' + editor.documentBaseURI.toAbsolute(url) + '">';
});
var bodyClass = editor.settings.body_class || '';
if (bodyClass.indexOf('=') != -1) {
bodyClass = editor.getParam('body_class', '', 'hash');
bodyClass = bodyClass[editor.id] || '';
}
html = (
'<!DOCTYPE html>' +
'<html>' +
'<head>' +
contentCssLinks +
'</head>' +
'<body class="' + bodyClass + '">' +
html +
'</body>' +
'</html>'
);
}
html = replaceTemplateValues(html, 'template_preview_replace_values');
var doc = win.find('iframe')[0].getEl().contentWindow.document;
doc.open();
doc.write(html);
doc.close();
}
if (value.url) {
tinymce.util.XHR.send({
url: value.url,
success: function(html) {
templateHtml = html;
insertIframeHtml(templateHtml);
}
});
} else {
templateHtml = value.content;
insertIframeHtml(templateHtml);
}
win.find('#description')[0].text(e.control.value().description);
}
win = editor.windowManager.open({
title: 'Insert template',
layout: 'flex',
direction: 'column',
align: 'stretch',
padding: 15,
spacing: 10,
items: [
{type: 'form', flex: 0, padding: 0, items: [
{type: 'container', label: 'Templates', items: {
type: 'listbox', label: 'Templates', name: 'template', values: values, onselect: onSelectTemplate
}}
]},
{type: 'label', name: 'description', label: 'Description', text: '\u00a0'},
{type: 'iframe', flex: 1, border: 1}
],
onsubmit: function() {
insertTemplate(false, templateHtml);
},
minWidth: Math.min(tinymce.DOM.getViewPort().w, editor.getParam('template_popup_width', 600)),
minHeight: Math.min(tinymce.DOM.getViewPort().h, editor.getParam('template_popup_height', 500))
});
win.find('listbox')[0].fire('select');
}
function getDateTime(fmt, date) {
var daysShort = "Sun Mon Tue Wed Thu Fri Sat Sun".split(' ');
var daysLong = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(' ');
var monthsShort = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(' ');
var monthsLong = "January February March April May June July August September October November December".split(' ');
function addZeros(value, len) {
value = "" + value;
if (value.length < len) {
for (var i = 0; i < (len - value.length); i++) {
value = "0" + value;
}
}
return value;
}
date = date || new Date();
fmt = fmt.replace("%D", "%m/%d/%Y");
fmt = fmt.replace("%r", "%I:%M:%S %p");
fmt = fmt.replace("%Y", "" + date.getFullYear());
fmt = fmt.replace("%y", "" + date.getYear());
fmt = fmt.replace("%m", addZeros(date.getMonth() + 1, 2));
fmt = fmt.replace("%d", addZeros(date.getDate(), 2));
fmt = fmt.replace("%H", "" + addZeros(date.getHours(), 2));
fmt = fmt.replace("%M", "" + addZeros(date.getMinutes(), 2));
fmt = fmt.replace("%S", "" + addZeros(date.getSeconds(), 2));
fmt = fmt.replace("%I", "" + ((date.getHours() + 11) % 12 + 1));
fmt = fmt.replace("%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
fmt = fmt.replace("%B", "" + editor.translate(monthsLong[date.getMonth()]));
fmt = fmt.replace("%b", "" + editor.translate(monthsShort[date.getMonth()]));
fmt = fmt.replace("%A", "" + editor.translate(daysLong[date.getDay()]));
fmt = fmt.replace("%a", "" + editor.translate(daysShort[date.getDay()]));
fmt = fmt.replace("%%", "%");
return fmt;
}
function replaceVals(e) {
var dom = editor.dom, vl = editor.getParam('template_replace_values');
each(dom.select('*', e), function(e) {
each(vl, function(v, k) {
if (dom.hasClass(e, k)) {
if (typeof vl[k] == 'function') {
vl[k](e);
}
}
});
});
}
function replaceTemplateValues(html, templateValuesOptionName) {
each(editor.getParam(templateValuesOptionName), function(v, k) {
if (typeof v == 'function') {
v = v(k);
}
html = html.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v);
});
return html;
}
function insertTemplate(ui, html) {
var el, n, dom = editor.dom, sel = editor.selection.getContent();
html = replaceTemplateValues(html, 'template_replace_values');
el = dom.create('div', null, html);
// Find template element within div
n = dom.select('.mceTmpl', el);
if (n && n.length > 0) {
el = dom.create('div', null);
el.appendChild(n[0].cloneNode(true));
}
function hasClass(n, c) {
return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
}
each(dom.select('*', el), function(n) {
// Replace cdate
if (hasClass(n, editor.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|'))) {
n.innerHTML = getDateTime(editor.getParam("template_cdate_format", editor.getLang("template.cdate_format")));
}
// Replace mdate
if (hasClass(n, editor.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) {
n.innerHTML = getDateTime(editor.getParam("template_mdate_format", editor.getLang("template.mdate_format")));
}
// Replace selection
if (hasClass(n, editor.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|'))) {
n.innerHTML = sel;
}
});
replaceVals(el);
editor.execCommand('mceInsertContent', false, el.innerHTML);
editor.addVisual();
}
editor.addCommand('mceInsertTemplate', insertTemplate);
editor.addButton('template', {
title: 'Insert template',
onclick: createTemplateList(showDialog)
});
editor.addMenuItem('template', {
text: 'Insert template',
onclick: createTemplateList(showDialog),
context: 'insert'
});
editor.on('PreProcess', function(o) {
var dom = editor.dom;
each(dom.select('div', o.node), function(e) {
if (dom.hasClass(e, 'mceTmpl')) {
each(dom.select('*', e), function(e) {
if (dom.hasClass(e, editor.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) {
e.innerHTML = getDateTime(editor.getParam("template_mdate_format", editor.getLang("template.mdate_format")));
}
});
replaceVals(e);
}
});
});
});
tinymce.PluginManager.add("template",function(a){function b(b){return function(){var c=a.settings.templates;return"function"==typeof c?void c(b):void("string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):b(c))}}function c(b){function c(b){function c(b){if(-1==b.indexOf("<html>")){var c="";tinymce.each(a.contentCSS,function(b){c+='<link type="text/css" rel="stylesheet" href="'+a.documentBaseURI.toAbsolute(b)+'">'});var e=a.settings.body_class||"";-1!=e.indexOf("=")&&(e=a.getParam("body_class","","hash"),e=e[a.id]||""),b="<!DOCTYPE html><html><head>"+c+'</head><body class="'+e+'">'+b+"</body></html>"}b=f(b,"template_preview_replace_values");var g=d.find("iframe")[0].getEl().contentWindow.document;g.open(),g.write(b),g.close()}var g=b.control.value();g.url?tinymce.util.XHR.send({url:g.url,success:function(a){e=a,c(e)}}):(e=g.content,c(e)),d.find("#description")[0].text(b.control.value().description)}var d,e,h=[];if(!b||0===b.length){var i=a.translate("No templates defined.");return void a.notificationManager.open({text:i,type:"info"})}tinymce.each(b,function(a){h.push({selected:!h.length,text:a.title,value:{url:a.url,content:a.content,description:a.description}})}),d=a.windowManager.open({title:"Insert template",layout:"flex",direction:"column",align:"stretch",padding:15,spacing:10,items:[{type:"form",flex:0,padding:0,items:[{type:"container",label:"Templates",items:{type:"listbox",label:"Templates",name:"template",values:h,onselect:c}}]},{type:"label",name:"description",label:"Description",text:"\xa0"},{type:"iframe",flex:1,border:1}],onsubmit:function(){g(!1,e)},minWidth:Math.min(tinymce.DOM.getViewPort().w,a.getParam("template_popup_width",600)),minHeight:Math.min(tinymce.DOM.getViewPort().h,a.getParam("template_popup_height",500))}),d.find("listbox")[0].fire("select")}function d(b,c){function d(a,b){if(a=""+a,a.length<b)for(var c=0;c<b-a.length;c++)a="0"+a;return a}var e="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),g="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),h="January February March April May June July August September October November December".split(" ");return c=c||new Date,b=b.replace("%D","%m/%d/%Y"),b=b.replace("%r","%I:%M:%S %p"),b=b.replace("%Y",""+c.getFullYear()),b=b.replace("%y",""+c.getYear()),b=b.replace("%m",d(c.getMonth()+1,2)),b=b.replace("%d",d(c.getDate(),2)),b=b.replace("%H",""+d(c.getHours(),2)),b=b.replace("%M",""+d(c.getMinutes(),2)),b=b.replace("%S",""+d(c.getSeconds(),2)),b=b.replace("%I",""+((c.getHours()+11)%12+1)),b=b.replace("%p",""+(c.getHours()<12?"AM":"PM")),b=b.replace("%B",""+a.translate(h[c.getMonth()])),b=b.replace("%b",""+a.translate(g[c.getMonth()])),b=b.replace("%A",""+a.translate(f[c.getDay()])),b=b.replace("%a",""+a.translate(e[c.getDay()])),b=b.replace("%%","%")}function e(b){var c=a.dom,d=a.getParam("template_replace_values");h(c.select("*",b),function(a){h(d,function(b,e){c.hasClass(a,e)&&"function"==typeof d[e]&&d[e](a)})})}function f(b,c){return h(a.getParam(c),function(a,c){"function"==typeof a&&(a=a(c)),b=b.replace(new RegExp("\\{\\$"+c+"\\}","g"),a)}),b}function g(b,c){function g(a,b){return new RegExp("\\b"+b+"\\b","g").test(a.className)}var i,j,k=a.dom,l=a.selection.getContent();c=f(c,"template_replace_values"),i=k.create("div",null,c),j=k.select(".mceTmpl",i),j&&j.length>0&&(i=k.create("div",null),i.appendChild(j[0].cloneNode(!0))),h(k.select("*",i),function(b){g(b,a.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_cdate_format",a.getLang("template.cdate_format")))),g(b,a.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_mdate_format",a.getLang("template.mdate_format")))),g(b,a.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))&&(b.innerHTML=l)}),e(i),a.execCommand("mceInsertContent",!1,i.innerHTML),a.addVisual()}var h=tinymce.each;a.addCommand("mceInsertTemplate",g),a.addButton("template",{title:"Insert template",onclick:b(c)}),a.addMenuItem("template",{text:"Insert template",onclick:b(c),context:"insert"}),a.on("PreProcess",function(b){var c=a.dom;h(c.select("div",b.node),function(b){c.hasClass(b,"mceTmpl")&&(h(c.select("*",b),function(b){c.hasClass(b,a.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_mdate_format",a.getLang("template.mdate_format"))))}),e(b))})})});
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
/*eslint consistent-this:0 */
tinymce.PluginManager.add('textcolor', function(editor) {
var cols, rows;
rows = {
forecolor: editor.settings.forecolor_rows || editor.settings.textcolor_rows || 5,
backcolor: editor.settings.backcolor_rows || editor.settings.textcolor_rows || 5
};
cols = {
forecolor: editor.settings.forecolor_cols || editor.settings.textcolor_cols || 8,
backcolor: editor.settings.backcolor_cols || editor.settings.textcolor_cols || 8
};
function getCurrentColor(format) {
var color;
editor.dom.getParents(editor.selection.getStart(), function(elm) {
var value;
if ((value = elm.style[format == 'forecolor' ? 'color' : 'background-color'])) {
color = value;
}
});
return color;
}
function mapColors(type) {
var i, colors = [], colorMap;
colorMap = [
"000000", "Black",
"993300", "Burnt orange",
"333300", "Dark olive",
"003300", "Dark green",
"003366", "Dark azure",
"000080", "Navy Blue",
"333399", "Indigo",
"333333", "Very dark gray",
"800000", "Maroon",
"FF6600", "Orange",
"808000", "Olive",
"008000", "Green",
"008080", "Teal",
"0000FF", "Blue",
"666699", "Grayish blue",
"808080", "Gray",
"FF0000", "Red",
"FF9900", "Amber",
"99CC00", "Yellow green",
"339966", "Sea green",
"33CCCC", "Turquoise",
"3366FF", "Royal blue",
"800080", "Purple",
"999999", "Medium gray",
"FF00FF", "Magenta",
"FFCC00", "Gold",
"FFFF00", "Yellow",
"00FF00", "Lime",
"00FFFF", "Aqua",
"00CCFF", "Sky blue",
"993366", "Red violet",
"FFFFFF", "White",
"FF99CC", "Pink",
"FFCC99", "Peach",
"FFFF99", "Light yellow",
"CCFFCC", "Pale green",
"CCFFFF", "Pale cyan",
"99CCFF", "Light sky blue",
"CC99FF", "Plum"
];
colorMap = editor.settings.textcolor_map || colorMap;
colorMap = editor.settings[type + '_map'] || colorMap;
for (i = 0; i < colorMap.length; i += 2) {
colors.push({
text: colorMap[i + 1],
color: '#' + colorMap[i]
});
}
return colors;
}
function renderColorPicker() {
var ctrl = this, colors, color, html, last, x, y, i, id = ctrl._id, count = 0, type;
type = ctrl.settings.origin;
function getColorCellHtml(color, title) {
var isNoColor = color == 'transparent';
return (
'<td class="mce-grid-cell' + (isNoColor ? ' mce-colorbtn-trans' : '') + '">' +
'<div id="' + id + '-' + (count++) + '"' +
' data-mce-color="' + (color ? color : '') + '"' +
' role="option"' +
' tabIndex="-1"' +
' style="' + (color ? 'background-color: ' + color : '') + '"' +
' title="' + tinymce.translate(title) + '">' +
(isNoColor ? '&#215;' : '') +
'</div>' +
'</td>'
);
}
colors = mapColors(type);
colors.push({
text: tinymce.translate("No color"),
color: "transparent"
});
html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
last = colors.length - 1;
for (y = 0; y < rows[type]; y++) {
html += '<tr>';
for (x = 0; x < cols[type]; x++) {
i = y * cols[type] + x;
if (i > last) {
html += '<td></td>';
} else {
color = colors[i];
html += getColorCellHtml(color.color, color.text);
}
}
html += '</tr>';
}
if (editor.settings.color_picker_callback) {
html += (
'<tr>' +
'<td colspan="' + cols[type] + '" class="mce-custom-color-btn">' +
'<div id="' + id + '-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" ' +
'role="button" tabindex="-1" aria-labelledby="' + id + '-c" style="width: 100%">' +
'<button type="button" role="presentation" tabindex="-1">' + tinymce.translate('Custom...') + '</button>' +
'</div>' +
'</td>' +
'</tr>'
);
html += '<tr>';
for (x = 0; x < cols[type]; x++) {
html += getColorCellHtml('', 'Custom color');
}
html += '</tr>';
}
html += '</tbody></table>';
return html;
}
function applyFormat(format, value) {
editor.undoManager.transact(function() {
editor.focus();
editor.formatter.apply(format, {value: value});
editor.nodeChanged();
});
}
function removeFormat(format) {
editor.undoManager.transact(function() {
editor.focus();
editor.formatter.remove(format, {value: null}, null, true);
editor.nodeChanged();
});
}
function onPanelClick(e) {
var buttonCtrl = this.parent(), value, type;
type = buttonCtrl.settings.origin;
function selectColor(value) {
buttonCtrl.hidePanel();
buttonCtrl.color(value);
applyFormat(buttonCtrl.settings.format, value);
}
function resetColor() {
buttonCtrl.hidePanel();
buttonCtrl.resetColor();
removeFormat(buttonCtrl.settings.format);
}
function setDivColor(div, value) {
div.style.background = value;
div.setAttribute('data-mce-color', value);
}
if (tinymce.DOM.getParent(e.target, '.mce-custom-color-btn')) {
buttonCtrl.hidePanel();
editor.settings.color_picker_callback.call(editor, function(value) {
var tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
var customColorCells, div, i;
customColorCells = tinymce.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function(elm) {
return elm.firstChild;
});
for (i = 0; i < customColorCells.length; i++) {
div = customColorCells[i];
if (!div.getAttribute('data-mce-color')) {
break;
}
}
// Shift colors to the right
// TODO: Might need to be the left on RTL
if (i == cols[type]) {
for (i = 0; i < cols[type] - 1; i++) {
setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
}
}
setDivColor(div, value);
selectColor(value);
}, getCurrentColor(buttonCtrl.settings.format));
}
value = e.target.getAttribute('data-mce-color');
if (value) {
if (this.lastId) {
document.getElementById(this.lastId).setAttribute('aria-selected', false);
}
e.target.setAttribute('aria-selected', true);
this.lastId = e.target.id;
if (value == 'transparent') {
resetColor();
} else {
selectColor(value);
}
} else if (value !== null) {
buttonCtrl.hidePanel();
}
}
function onButtonClick() {
var self = this;
if (self._color) {
applyFormat(self.settings.format, self._color);
} else {
removeFormat(self.settings.format);
}
}
editor.addButton('forecolor', {
type: 'colorbutton',
tooltip: 'Text color',
format: 'forecolor',
panel: {
origin: 'forecolor',
role: 'application',
ariaRemember: true,
html: renderColorPicker,
onclick: onPanelClick
},
onclick: onButtonClick
});
editor.addButton('backcolor', {
type: 'colorbutton',
tooltip: 'Background color',
format: 'hilitecolor',
panel: {
origin: 'backcolor',
role: 'application',
ariaRemember: true,
html: renderColorPicker,
onclick: onPanelClick
},
onclick: onButtonClick
});
});
tinymce.PluginManager.add("textcolor",function(a){function b(b){var c;return a.dom.getParents(a.selection.getStart(),function(a){var d;(d=a.style["forecolor"==b?"color":"background-color"])&&(c=d)}),c}function c(b){var c,d,e=[];for(d=["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],d=a.settings.textcolor_map||d,d=a.settings[b+"_map"]||d,c=0;c<d.length;c+=2)e.push({text:d[c+1],color:"#"+d[c]});return e}function d(){function b(a,b){var c="transparent"==a;return'<td class="mce-grid-cell'+(c?" mce-colorbtn-trans":"")+'"><div id="'+o+"-"+p++ +'" data-mce-color="'+(a?a:"")+'" role="option" tabIndex="-1" style="'+(a?"background-color: "+a:"")+'" title="'+tinymce.translate(b)+'">'+(c?"&#215;":"")+"</div></td>"}var d,e,f,g,h,k,l,m,n=this,o=n._id,p=0;for(m=n.settings.origin,d=c(m),d.push({text:tinymce.translate("No color"),color:"transparent"}),f='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',g=d.length-1,k=0;k<j[m];k++){for(f+="<tr>",h=0;h<i[m];h++)l=k*i[m]+h,l>g?f+="<td></td>":(e=d[l],f+=b(e.color,e.text));f+="</tr>"}if(a.settings.color_picker_callback){for(f+='<tr><td colspan="'+i[m]+'" class="mce-custom-color-btn"><div id="'+o+'-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" role="button" tabindex="-1" aria-labelledby="'+o+'-c" style="width: 100%"><button type="button" role="presentation" tabindex="-1">'+tinymce.translate("Custom...")+"</button></div></td></tr>",f+="<tr>",h=0;h<i[m];h++)f+=b("","Custom color");f+="</tr>"}return f+="</tbody></table>"}function e(b,c){a.undoManager.transact(function(){a.focus(),a.formatter.apply(b,{value:c}),a.nodeChanged()})}function f(b){a.undoManager.transact(function(){a.focus(),a.formatter.remove(b,{value:null},null,!0),a.nodeChanged()})}function g(c){function d(a){l.hidePanel(),l.color(a),e(l.settings.format,a)}function g(){l.hidePanel(),l.resetColor(),f(l.settings.format)}function h(a,b){a.style.background=b,a.setAttribute("data-mce-color",b)}var j,k,l=this.parent();k=l.settings.origin,tinymce.DOM.getParent(c.target,".mce-custom-color-btn")&&(l.hidePanel(),a.settings.color_picker_callback.call(a,function(a){var b,c,e,f=l.panel.getEl().getElementsByTagName("table")[0];for(b=tinymce.map(f.rows[f.rows.length-1].childNodes,function(a){return a.firstChild}),e=0;e<b.length&&(c=b[e],c.getAttribute("data-mce-color"));e++);if(e==i[k])for(e=0;e<i[k]-1;e++)h(b[e],b[e+1].getAttribute("data-mce-color"));h(c,a),d(a)},b(l.settings.format))),j=c.target.getAttribute("data-mce-color"),j?(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),c.target.setAttribute("aria-selected",!0),this.lastId=c.target.id,"transparent"==j?g():d(j)):null!==j&&l.hidePanel()}function h(){var a=this;a._color?e(a.settings.format,a._color):f(a.settings.format)}var i,j;j={forecolor:a.settings.forecolor_rows||a.settings.textcolor_rows||5,backcolor:a.settings.backcolor_rows||a.settings.textcolor_rows||5},i={forecolor:a.settings.forecolor_cols||a.settings.textcolor_cols||8,backcolor:a.settings.backcolor_cols||a.settings.textcolor_cols||8},a.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{origin:"forecolor",role:"application",ariaRemember:!0,html:d,onclick:g},onclick:h}),a.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{origin:"backcolor",role:"application",ariaRemember:!0,html:d,onclick:g},onclick:h})});
\ No newline at end of file
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('textpattern', function(editor) {
var isPatternsDirty = true, patterns;
patterns = editor.settings.textpattern_patterns || [
{start: '*', end: '*', format: 'italic'},
{start: '**', end: '**', format: 'bold'},
{start: '#', format: 'h1'},
{start: '##', format: 'h2'},
{start: '###', format: 'h3'},
{start: '####', format: 'h4'},
{start: '#####', format: 'h5'},
{start: '######', format: 'h6'},
{start: '1. ', cmd: 'InsertOrderedList'},
{start: '* ', cmd: 'InsertUnorderedList'},
{start: '- ', cmd: 'InsertUnorderedList'}
];
// Returns a sorted patterns list, ordered descending by start length
function getPatterns() {
if (isPatternsDirty) {
patterns.sort(function(a, b) {
if (a.start.length > b.start.length) {
return -1;
}
if (a.start.length < b.start.length) {
return 1;
}
return 0;
});
isPatternsDirty = false;
}
return patterns;
}
// Finds a matching pattern to the specified text
function findPattern(text) {
var patterns = getPatterns();
for (var i = 0; i < patterns.length; i++) {
if (text.indexOf(patterns[i].start) !== 0) {
continue;
}
if (patterns[i].end && text.lastIndexOf(patterns[i].end) != text.length - patterns[i].end.length) {
continue;
}
return patterns[i];
}
}
// Finds the best matching end pattern
function findEndPattern(text, offset, delta) {
var patterns, pattern, i;
// Find best matching end
patterns = getPatterns();
for (i = 0; i < patterns.length; i++) {
pattern = patterns[i];
if (pattern.end && text.substr(offset - pattern.end.length - delta, pattern.end.length) == pattern.end) {
return pattern;
}
}
}
// Handles inline formats like *abc* and **abc**
function applyInlineFormat(space) {
var selection, dom, rng, container, offset, startOffset, text, patternRng, pattern, delta, format;
function splitContainer() {
// Split text node and remove start/end from text node
container = container.splitText(startOffset);
container.splitText(offset - startOffset - delta);
container.deleteData(0, pattern.start.length);
container.deleteData(container.data.length - pattern.end.length, pattern.end.length);
}
selection = editor.selection;
dom = editor.dom;
if (!selection.isCollapsed()) {
return;
}
rng = selection.getRng(true);
container = rng.startContainer;
offset = rng.startOffset;
text = container.data;
delta = space ? 1 : 0;
if (container.nodeType != 3) {
return;
}
// Find best matching end
pattern = findEndPattern(text, offset, delta);
if (!pattern) {
return;
}
// Find start of matched pattern
// TODO: Might need to improve this if there is nested formats
startOffset = Math.max(0, offset - delta);
startOffset = text.lastIndexOf(pattern.start, startOffset - pattern.end.length - 1);
if (startOffset === -1) {
return;
}
// Setup a range for the matching word
patternRng = dom.createRng();
patternRng.setStart(container, startOffset);
patternRng.setEnd(container, offset - delta);
pattern = findPattern(patternRng.toString());
if (!pattern || !pattern.end) {
return;
}
// If container match doesn't have anything between start/end then do nothing
if (container.data.length <= pattern.start.length + pattern.end.length) {
return;
}
format = editor.formatter.get(pattern.format);
if (format && format[0].inline) {
splitContainer();
editor.formatter.apply(pattern.format, {}, container);
return container;
}
}
// Handles block formats like ##abc or 1. abc
function applyBlockFormat() {
var selection, dom, container, firstTextNode, node, format, textBlockElm, pattern, walker, rng, offset;
selection = editor.selection;
dom = editor.dom;
if (!selection.isCollapsed()) {
return;
}
textBlockElm = dom.getParent(selection.getStart(), 'p');
if (textBlockElm) {
walker = new tinymce.dom.TreeWalker(textBlockElm, textBlockElm);
while ((node = walker.next())) {
if (node.nodeType == 3) {
firstTextNode = node;
break;
}
}
if (firstTextNode) {
pattern = findPattern(firstTextNode.data);
if (!pattern) {
return;
}
rng = selection.getRng(true);
container = rng.startContainer;
offset = rng.startOffset;
if (firstTextNode == container) {
offset = Math.max(0, offset - pattern.start.length);
}
if (tinymce.trim(firstTextNode.data).length == pattern.start.length) {
return;
}
if (pattern.format) {
format = editor.formatter.get(pattern.format);
if (format && format[0].block) {
firstTextNode.deleteData(0, pattern.start.length);
editor.formatter.apply(pattern.format, {}, firstTextNode);
rng.setStart(container, offset);
rng.collapse(true);
selection.setRng(rng);
}
}
if (pattern.cmd) {
editor.undoManager.transact(function() {
firstTextNode.deleteData(0, pattern.start.length);
editor.execCommand(pattern.cmd);
});
}
}
}
}
function handleEnter() {
var rng, wrappedTextNode;
wrappedTextNode = applyInlineFormat();
if (wrappedTextNode) {
rng = editor.dom.createRng();
rng.setStart(wrappedTextNode, wrappedTextNode.data.length);
rng.setEnd(wrappedTextNode, wrappedTextNode.data.length);
editor.selection.setRng(rng);
}
applyBlockFormat();
}
function handleSpace() {
var wrappedTextNode, lastChar, lastCharNode, rng, dom;
wrappedTextNode = applyInlineFormat(true);
if (wrappedTextNode) {
dom = editor.dom;
lastChar = wrappedTextNode.data.slice(-1);
// Move space after the newly formatted node
if (/[\u00a0 ]/.test(lastChar)) {
wrappedTextNode.deleteData(wrappedTextNode.data.length - 1, 1);
lastCharNode = dom.doc.createTextNode(lastChar);
if (wrappedTextNode.nextSibling) {
dom.insertAfter(lastCharNode, wrappedTextNode.nextSibling);
} else {
wrappedTextNode.parentNode.appendChild(lastCharNode);
}
rng = dom.createRng();
rng.setStart(lastCharNode, 1);
rng.setEnd(lastCharNode, 1);
editor.selection.setRng(rng);
}
}
}
editor.on('keydown', function(e) {
if (e.keyCode == 13 && !tinymce.util.VK.modifierPressed(e)) {
handleEnter();
}
}, true);
editor.on('keyup', function(e) {
if (e.keyCode == 32 && !tinymce.util.VK.modifierPressed(e)) {
handleSpace();
}
});
this.getPatterns = getPatterns;
this.setPatterns = function(newPatterns) {
patterns = newPatterns;
isPatternsDirty = true;
};
});
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.