mirror of
https://github.com/documize/community.git
synced 2025-07-23 07:09:43 +02:00
WIP vendored dep upgrades
This commit is contained in:
parent
5f59e95495
commit
6409ad0d63
190 changed files with 64265 additions and 109666 deletions
550
gui/public/tinymce/plugins/autolink/plugin.js
Executable file → Normal file
550
gui/public/tinymce/plugins/autolink/plugin.js
Executable file → Normal file
|
@ -1,404 +1,180 @@
|
|||
(function () {
|
||||
var autolink = (function () {
|
||||
'use strict';
|
||||
|
||||
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
||||
var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
// Used when there is no 'main' module.
|
||||
// The name is probably (hopefully) unique so minification removes for releases.
|
||||
var register_3795 = function (id) {
|
||||
var module = dem(id);
|
||||
var fragments = id.split('.');
|
||||
var target = Function('return this;')();
|
||||
for (var i = 0; i < fragments.length - 1; ++i) {
|
||||
if (target[fragments[i]] === undefined)
|
||||
target[fragments[i]] = {};
|
||||
target = target[fragments[i]];
|
||||
}
|
||||
target[fragments[fragments.length - 1]] = module;
|
||||
};
|
||||
var Env = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var instantiate = function (id) {
|
||||
var actual = defs[id];
|
||||
var dependencies = actual.deps;
|
||||
var definition = actual.defn;
|
||||
var len = dependencies.length;
|
||||
var instances = new Array(len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
instances[i] = dem(dependencies[i]);
|
||||
var defResult = definition.apply(null, instances);
|
||||
if (defResult === undefined)
|
||||
throw 'module [' + id + '] returned undefined';
|
||||
actual.instance = defResult;
|
||||
};
|
||||
|
||||
var def = function (id, dependencies, definition) {
|
||||
if (typeof id !== 'string')
|
||||
throw 'module id must be a string';
|
||||
else if (dependencies === undefined)
|
||||
throw 'no dependencies for ' + id;
|
||||
else if (definition === undefined)
|
||||
throw 'no definition function for ' + id;
|
||||
defs[id] = {
|
||||
deps: dependencies,
|
||||
defn: definition,
|
||||
instance: undefined
|
||||
var getAutoLinkPattern = function (editor) {
|
||||
return editor.getParam('autolink_pattern', /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i);
|
||||
};
|
||||
var getDefaultLinkTarget = function (editor) {
|
||||
return editor.getParam('default_link_target', '');
|
||||
};
|
||||
var $_5s2ipn7ujcg89byg = {
|
||||
getAutoLinkPattern: getAutoLinkPattern,
|
||||
getDefaultLinkTarget: getDefaultLinkTarget
|
||||
};
|
||||
};
|
||||
|
||||
var dem = function (id) {
|
||||
var actual = defs[id];
|
||||
if (actual === undefined)
|
||||
throw 'module [' + id + '] was undefined';
|
||||
else if (actual.instance === undefined)
|
||||
instantiate(id);
|
||||
return actual.instance;
|
||||
};
|
||||
|
||||
var req = function (ids, callback) {
|
||||
var len = ids.length;
|
||||
var instances = new Array(len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
instances[i] = dem(ids[i]);
|
||||
callback.apply(null, instances);
|
||||
};
|
||||
|
||||
var ephox = {};
|
||||
|
||||
ephox.bolt = {
|
||||
module: {
|
||||
api: {
|
||||
define: def,
|
||||
require: req,
|
||||
demand: dem
|
||||
var rangeEqualsDelimiterOrSpace = function (rangeString, delimiter) {
|
||||
return rangeString === delimiter || rangeString === ' ' || rangeString.charCodeAt(0) === 160;
|
||||
};
|
||||
var handleEclipse = function (editor) {
|
||||
parseCurrentLine(editor, -1, '(');
|
||||
};
|
||||
var handleSpacebar = function (editor) {
|
||||
parseCurrentLine(editor, 0, '');
|
||||
};
|
||||
var handleEnter = function (editor) {
|
||||
parseCurrentLine(editor, -1, '');
|
||||
};
|
||||
var scopeIndex = function (container, index) {
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var define = def;
|
||||
var require = req;
|
||||
var demand = dem;
|
||||
// this helps with minification when using a lot of global references
|
||||
var defineGlobal = function (id, ref) {
|
||||
define(id, [], function () { return ref; });
|
||||
};
|
||||
/*jsc
|
||||
["tinymce.plugins.autolink.Plugin","tinymce.core.Env","tinymce.core.PluginManager","tinymce.plugins.autolink.core.Keys","global!tinymce.util.Tools.resolve","tinymce.plugins.autolink.api.Settings"]
|
||||
jsc*/
|
||||
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
||||
/**
|
||||
* ResolveGlobal.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.core.Env',
|
||||
[
|
||||
'global!tinymce.util.Tools.resolve'
|
||||
],
|
||||
function (resolve) {
|
||||
return resolve('tinymce.Env');
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* ResolveGlobal.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.core.PluginManager',
|
||||
[
|
||||
'global!tinymce.util.Tools.resolve'
|
||||
],
|
||||
function (resolve) {
|
||||
return resolve('tinymce.PluginManager');
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.plugins.autolink.api.Settings',
|
||||
[
|
||||
],
|
||||
function () {
|
||||
var getAutoLinkPattern = function (editor) {
|
||||
return editor.getParam('autolink_pattern', /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i);
|
||||
};
|
||||
|
||||
var getDefaultLinkTarget = function (editor) {
|
||||
return editor.getParam('default_link_target', '');
|
||||
};
|
||||
|
||||
return {
|
||||
getAutoLinkPattern: getAutoLinkPattern,
|
||||
getDefaultLinkTarget: getDefaultLinkTarget
|
||||
};
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Keys.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.plugins.autolink.core.Keys',
|
||||
[
|
||||
'tinymce.core.Env',
|
||||
'tinymce.core.PluginManager',
|
||||
'tinymce.plugins.autolink.api.Settings'
|
||||
],
|
||||
function (Env, PluginManager, Settings) {
|
||||
var rangeEqualsDelimiterOrSpace = function (rangeString, delimiter) {
|
||||
return rangeString === delimiter || rangeString === ' ' || rangeString.charCodeAt(0) === 160;
|
||||
};
|
||||
|
||||
var handleEclipse = function (editor) {
|
||||
parseCurrentLine(editor, -1, '(', true);
|
||||
};
|
||||
|
||||
var handleSpacebar = function (editor) {
|
||||
parseCurrentLine(editor, 0, '', true);
|
||||
};
|
||||
|
||||
var handleEnter = function (editor) {
|
||||
parseCurrentLine(editor, -1, '', false);
|
||||
};
|
||||
|
||||
var scopeIndex = function (container, index) {
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
if (container.nodeType === 3) {
|
||||
var len = container.data.length;
|
||||
if (index > len) {
|
||||
index = len;
|
||||
}
|
||||
|
||||
if (container.nodeType === 3) {
|
||||
var len = container.data.length;
|
||||
|
||||
if (index > len) {
|
||||
index = len;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
};
|
||||
|
||||
var setStart = function (rng, container, offset) {
|
||||
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
||||
rng.setStart(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setStartBefore(container);
|
||||
}
|
||||
};
|
||||
|
||||
var setEnd = function (rng, container, offset) {
|
||||
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
||||
rng.setEnd(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setEndAfter(container);
|
||||
}
|
||||
};
|
||||
|
||||
var parseCurrentLine = function (editor, endOffset, delimiter) {
|
||||
var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText;
|
||||
var autoLinkPattern = Settings.getAutoLinkPattern(editor);
|
||||
var defaultLinkTarget = Settings.getDefaultLinkTarget(editor);
|
||||
|
||||
// Never create a link when we are inside a link
|
||||
if (editor.selection.getNode().tagName === 'A') {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need at least five characters to form a URL,
|
||||
// hence, at minimum, five characters from the beginning of the line.
|
||||
rng = editor.selection.getRng(true).cloneRange();
|
||||
if (rng.startOffset < 5) {
|
||||
// During testing, the caret is placed between two text nodes.
|
||||
// The previous text node contains the URL.
|
||||
prev = rng.endContainer.previousSibling;
|
||||
if (!prev) {
|
||||
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
|
||||
return;
|
||||
}
|
||||
|
||||
prev = rng.endContainer.firstChild.nextSibling;
|
||||
}
|
||||
|
||||
len = prev.length;
|
||||
setStart(rng, prev, len);
|
||||
setEnd(rng, prev, len);
|
||||
|
||||
if (rng.endOffset < 5) {
|
||||
}
|
||||
return index;
|
||||
};
|
||||
var setStart = function (rng, container, offset) {
|
||||
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
||||
rng.setStart(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setStartBefore(container);
|
||||
}
|
||||
};
|
||||
var setEnd = function (rng, container, offset) {
|
||||
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
||||
rng.setEnd(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setEndAfter(container);
|
||||
}
|
||||
};
|
||||
var parseCurrentLine = function (editor, endOffset, delimiter) {
|
||||
var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText;
|
||||
var autoLinkPattern = $_5s2ipn7ujcg89byg.getAutoLinkPattern(editor);
|
||||
var defaultLinkTarget = $_5s2ipn7ujcg89byg.getDefaultLinkTarget(editor);
|
||||
if (editor.selection.getNode().tagName === 'A') {
|
||||
return;
|
||||
}
|
||||
rng = editor.selection.getRng(true).cloneRange();
|
||||
if (rng.startOffset < 5) {
|
||||
prev = rng.endContainer.previousSibling;
|
||||
if (!prev) {
|
||||
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
|
||||
return;
|
||||
}
|
||||
|
||||
end = rng.endOffset;
|
||||
endContainer = prev;
|
||||
} else {
|
||||
endContainer = rng.endContainer;
|
||||
|
||||
// Get a text node
|
||||
if (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
||||
while (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
||||
endContainer = endContainer.firstChild;
|
||||
}
|
||||
|
||||
// Move range to text node
|
||||
if (endContainer.nodeType === 3) {
|
||||
setStart(rng, endContainer, 0);
|
||||
setEnd(rng, endContainer, endContainer.nodeValue.length);
|
||||
}
|
||||
}
|
||||
|
||||
if (rng.endOffset === 1) {
|
||||
end = 2;
|
||||
} else {
|
||||
end = rng.endOffset - 1 - endOffset;
|
||||
}
|
||||
prev = rng.endContainer.firstChild.nextSibling;
|
||||
}
|
||||
|
||||
start = end;
|
||||
|
||||
do {
|
||||
// Move the selection one character backwards.
|
||||
setStart(rng, endContainer, end >= 2 ? end - 2 : 0);
|
||||
setEnd(rng, endContainer, end >= 1 ? end - 1 : 0);
|
||||
end -= 1;
|
||||
rngText = rng.toString();
|
||||
|
||||
// Loop until one of the following is found: a blank space, , delimiter, (end-2) >= 0
|
||||
} while (rngText !== ' ' && rngText !== '' && rngText.charCodeAt(0) !== 160 && (end - 2) >= 0 && rngText !== delimiter);
|
||||
|
||||
if (rangeEqualsDelimiterOrSpace(rng.toString(), delimiter)) {
|
||||
setStart(rng, endContainer, end);
|
||||
setEnd(rng, endContainer, start);
|
||||
end += 1;
|
||||
} else if (rng.startOffset === 0) {
|
||||
setStart(rng, endContainer, 0);
|
||||
setEnd(rng, endContainer, start);
|
||||
} else {
|
||||
setStart(rng, endContainer, end);
|
||||
setEnd(rng, endContainer, start);
|
||||
}
|
||||
|
||||
// Exclude last . from word like "www.site.com."
|
||||
text = rng.toString();
|
||||
if (text.charAt(text.length - 1) === '.') {
|
||||
setEnd(rng, endContainer, start - 1);
|
||||
}
|
||||
|
||||
text = rng.toString().trim();
|
||||
matches = text.match(autoLinkPattern);
|
||||
|
||||
if (matches) {
|
||||
if (matches[1] === 'www.') {
|
||||
matches[1] = 'http://www.';
|
||||
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
||||
matches[1] = 'mailto:' + matches[1];
|
||||
}
|
||||
|
||||
bookmark = editor.selection.getBookmark();
|
||||
|
||||
editor.selection.setRng(rng);
|
||||
editor.execCommand('createlink', false, matches[1] + matches[2]);
|
||||
|
||||
if (defaultLinkTarget) {
|
||||
editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget);
|
||||
}
|
||||
|
||||
editor.selection.moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
};
|
||||
|
||||
var setup = function (editor) {
|
||||
var autoUrlDetectState;
|
||||
|
||||
editor.on("keydown", function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
return handleEnter(editor);
|
||||
}
|
||||
});
|
||||
|
||||
// Internet Explorer has built-in automatic linking for most cases
|
||||
if (Env.ie) {
|
||||
editor.on("focus", function () {
|
||||
if (!autoUrlDetectState) {
|
||||
autoUrlDetectState = true;
|
||||
|
||||
try {
|
||||
editor.execCommand('AutoUrlDetect', false, true);
|
||||
} catch (ex) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
len = prev.length;
|
||||
setStart(rng, prev, len);
|
||||
setEnd(rng, prev, len);
|
||||
if (rng.endOffset < 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
editor.on("keypress", function (e) {
|
||||
if (e.keyCode === 41) {
|
||||
return handleEclipse(editor);
|
||||
end = rng.endOffset;
|
||||
endContainer = prev;
|
||||
} else {
|
||||
endContainer = rng.endContainer;
|
||||
if (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
||||
while (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
||||
endContainer = endContainer.firstChild;
|
||||
}
|
||||
});
|
||||
|
||||
editor.on("keyup", function (e) {
|
||||
if (e.keyCode === 32) {
|
||||
return handleSpacebar(editor);
|
||||
if (endContainer.nodeType === 3) {
|
||||
setStart(rng, endContainer, 0);
|
||||
setEnd(rng, endContainer, endContainer.nodeValue.length);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
setup: setup
|
||||
};
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
define(
|
||||
'tinymce.plugins.autolink.Plugin',
|
||||
[
|
||||
'tinymce.core.Env',
|
||||
'tinymce.core.PluginManager',
|
||||
'tinymce.plugins.autolink.core.Keys'
|
||||
],
|
||||
function (Env, PluginManager, Keys) {
|
||||
PluginManager.add('autolink', function (editor) {
|
||||
Keys.setup(editor);
|
||||
}
|
||||
if (rng.endOffset === 1) {
|
||||
end = 2;
|
||||
} else {
|
||||
end = rng.endOffset - 1 - endOffset;
|
||||
}
|
||||
}
|
||||
start = end;
|
||||
do {
|
||||
setStart(rng, endContainer, end >= 2 ? end - 2 : 0);
|
||||
setEnd(rng, endContainer, end >= 1 ? end - 1 : 0);
|
||||
end -= 1;
|
||||
rngText = rng.toString();
|
||||
} while (rngText !== ' ' && rngText !== '' && rngText.charCodeAt(0) !== 160 && end - 2 >= 0 && rngText !== delimiter);
|
||||
if (rangeEqualsDelimiterOrSpace(rng.toString(), delimiter)) {
|
||||
setStart(rng, endContainer, end);
|
||||
setEnd(rng, endContainer, start);
|
||||
end += 1;
|
||||
} else if (rng.startOffset === 0) {
|
||||
setStart(rng, endContainer, 0);
|
||||
setEnd(rng, endContainer, start);
|
||||
} else {
|
||||
setStart(rng, endContainer, end);
|
||||
setEnd(rng, endContainer, start);
|
||||
}
|
||||
text = rng.toString();
|
||||
if (text.charAt(text.length - 1) === '.') {
|
||||
setEnd(rng, endContainer, start - 1);
|
||||
}
|
||||
text = rng.toString().trim();
|
||||
matches = text.match(autoLinkPattern);
|
||||
if (matches) {
|
||||
if (matches[1] === 'www.') {
|
||||
matches[1] = 'http://www.';
|
||||
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
||||
matches[1] = 'mailto:' + matches[1];
|
||||
}
|
||||
bookmark = editor.selection.getBookmark();
|
||||
editor.selection.setRng(rng);
|
||||
editor.execCommand('createlink', false, matches[1] + matches[2]);
|
||||
if (defaultLinkTarget) {
|
||||
editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget);
|
||||
}
|
||||
editor.selection.moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
};
|
||||
var setup = function (editor) {
|
||||
var autoUrlDetectState;
|
||||
editor.on('keydown', function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
return handleEnter(editor);
|
||||
}
|
||||
});
|
||||
if (Env.ie) {
|
||||
editor.on('focus', function () {
|
||||
if (!autoUrlDetectState) {
|
||||
autoUrlDetectState = true;
|
||||
try {
|
||||
editor.execCommand('AutoUrlDetect', false, true);
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
editor.on('keypress', function (e) {
|
||||
if (e.keyCode === 41) {
|
||||
return handleEclipse(editor);
|
||||
}
|
||||
});
|
||||
editor.on('keyup', function (e) {
|
||||
if (e.keyCode === 32) {
|
||||
return handleSpacebar(editor);
|
||||
}
|
||||
});
|
||||
};
|
||||
var $_6h6zuk7sjcg89by9 = { setup: setup };
|
||||
|
||||
return function () { };
|
||||
}
|
||||
);
|
||||
dem('tinymce.plugins.autolink.Plugin')();
|
||||
})();
|
||||
PluginManager.add('autolink', function (editor) {
|
||||
$_6h6zuk7sjcg89by9.setup(editor);
|
||||
});
|
||||
var Plugin = function () {
|
||||
};
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})()
|
||||
|
|
2
gui/public/tinymce/plugins/autolink/plugin.min.js
vendored
Executable file → Normal file
2
gui/public/tinymce/plugins/autolink/plugin.min.js
vendored
Executable file → Normal file
|
@ -1 +1 @@
|
|||
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("4",tinymce.util.Tools.resolve),g("1",["4"],function(a){return a("tinymce.Env")}),g("2",["4"],function(a){return a("tinymce.PluginManager")}),g("5",[],function(){var a=function(a){return a.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},b=function(a){return a.getParam("default_link_target","")};return{getAutoLinkPattern:a,getDefaultLinkTarget:b}}),g("3",["1","2","5"],function(a,b,c){var d=function(a,b){return a===b||" "===a||160===a.charCodeAt(0)},e=function(a){k(a,-1,"(",!0)},f=function(a){k(a,0,"",!0)},g=function(a){k(a,-1,"",!1)},h=function(a,b){if(b<0&&(b=0),3===a.nodeType){var c=a.data.length;b>c&&(b=c)}return b},i=function(a,b,c){1!==b.nodeType||b.hasChildNodes()?a.setStart(b,h(b,c)):a.setStartBefore(b)},j=function(a,b,c){1!==b.nodeType||b.hasChildNodes()?a.setEnd(b,h(b,c)):a.setEndAfter(b)},k=function(a,b,e){var f,g,h,k,l,m,n,o,p,q,r=c.getAutoLinkPattern(a),s=c.getDefaultLinkTarget(a);if("A"!==a.selection.getNode().tagName){if(f=a.selection.getRng(!0).cloneRange(),f.startOffset<5){if(o=f.endContainer.previousSibling,!o){if(!f.endContainer.firstChild||!f.endContainer.firstChild.nextSibling)return;o=f.endContainer.firstChild.nextSibling}if(p=o.length,i(f,o,p),j(f,o,p),f.endOffset<5)return;g=f.endOffset,k=o}else{if(k=f.endContainer,3!==k.nodeType&&k.firstChild){for(;3!==k.nodeType&&k.firstChild;)k=k.firstChild;3===k.nodeType&&(i(f,k,0),j(f,k,k.nodeValue.length))}g=1===f.endOffset?2:f.endOffset-1-b}h=g;do i(f,k,g>=2?g-2:0),j(f,k,g>=1?g-1:0),g-=1,q=f.toString();while(" "!==q&&""!==q&&160!==q.charCodeAt(0)&&g-2>=0&&q!==e);d(f.toString(),e)?(i(f,k,g),j(f,k,h),g+=1):0===f.startOffset?(i(f,k,0),j(f,k,h)):(i(f,k,g),j(f,k,h)),m=f.toString(),"."===m.charAt(m.length-1)&&j(f,k,h-1),m=f.toString().trim(),n=m.match(r),n&&("www."===n[1]?n[1]="http://www.":/@$/.test(n[1])&&!/^mailto:/.test(n[1])&&(n[1]="mailto:"+n[1]),l=a.selection.getBookmark(),a.selection.setRng(f),a.execCommand("createlink",!1,n[1]+n[2]),s&&a.dom.setAttrib(a.selection.getNode(),"target",s),a.selection.moveToBookmark(l),a.nodeChanged())}},l=function(b){var c;return b.on("keydown",function(a){if(13===a.keyCode)return g(b)}),a.ie?void b.on("focus",function(){if(!c){c=!0;try{b.execCommand("AutoUrlDetect",!1,!0)}catch(a){}}}):(b.on("keypress",function(a){if(41===a.keyCode)return e(b)}),void b.on("keyup",function(a){if(32===a.keyCode)return f(b)}))};return{setup:l}}),g("0",["1","2","3"],function(a,b,c){return b.add("autolink",function(a){c.setup(a)}),function(){}}),d("0")()}();
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),n=function(e){return e.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},i=function(e){return e.getParam("default_link_target","")},o=function(e,t){if(t<0&&(t=0),3===e.nodeType){var n=e.data.length;t>n&&(t=n)}return t},r=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setStart(t,o(t,n)):e.setStartBefore(t)},f=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setEnd(t,o(t,n)):e.setEndAfter(t)},a=function(e,t,o){var a,d,s,l,c,u,g,h,C,m,y=n(e),k=i(e);if("A"!==e.selection.getNode().tagName){if((a=e.selection.getRng(!0).cloneRange()).startOffset<5){if(!(h=a.endContainer.previousSibling)){if(!a.endContainer.firstChild||!a.endContainer.firstChild.nextSibling)return;h=a.endContainer.firstChild.nextSibling}if(C=h.length,r(a,h,C),f(a,h,C),a.endOffset<5)return;d=a.endOffset,l=h}else{if(3!==(l=a.endContainer).nodeType&&l.firstChild){for(;3!==l.nodeType&&l.firstChild;)l=l.firstChild;3===l.nodeType&&(r(a,l,0),f(a,l,l.nodeValue.length))}d=1===a.endOffset?2:a.endOffset-1-t}s=d;do{r(a,l,d>=2?d-2:0),f(a,l,d>=1?d-1:0),d-=1,m=a.toString()}while(" "!==m&&""!==m&&160!==m.charCodeAt(0)&&d-2>=0&&m!==o);!function(e,t){return e===t||" "===e||160===e.charCodeAt(0)}(a.toString(),o)?0===a.startOffset?(r(a,l,0),f(a,l,s)):(r(a,l,d),f(a,l,s)):(r(a,l,d),f(a,l,s),d+=1),"."===(u=a.toString()).charAt(u.length-1)&&f(a,l,s-1),(g=(u=a.toString().trim()).match(y))&&("www."===g[1]?g[1]="http://www.":/@$/.test(g[1])&&!/^mailto:/.test(g[1])&&(g[1]="mailto:"+g[1]),c=e.selection.getBookmark(),e.selection.setRng(a),e.execCommand("createlink",!1,g[1]+g[2]),k&&e.dom.setAttrib(e.selection.getNode(),"target",k),e.selection.moveToBookmark(c),e.nodeChanged())}},d=function(e){var n;e.on("keydown",function(t){if(13===t.keyCode)return function(e){a(e,-1,"")}(e)}),t.ie?e.on("focus",function(){if(!n){n=!0;try{e.execCommand("AutoUrlDetect",!1,!0)}catch(t){}}}):(e.on("keypress",function(t){if(41===t.keyCode)return function(e){a(e,-1,"(")}(e)}),e.on("keyup",function(t){if(32===t.keyCode)return function(e){a(e,0,"")}(e)}))};e.add("autolink",function(e){d(e)})}();
|
Loading…
Add table
Add a link
Reference in a new issue