bedrock_sass 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/_vendor/tinymce/plugins/advlist/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.js +428 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/anchor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autolink/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.js +404 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autoresize/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +451 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autosave/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.js +608 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/bbcode/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +264 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/charmap/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.js +850 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/code/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/codesample/css/prism.css +138 -0
- data/assets/_vendor/tinymce/plugins/codesample/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.js +1582 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +272 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +496 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/directionality/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.js +270 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +256 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullpage/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +962 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +455 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/help/img/logo.png +0 -0
- data/assets/_vendor/tinymce/plugins/help/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.js +1527 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/hr/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.js +195 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/image/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.js +1572 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/imagetools/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +4444 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +2 -0
- data/assets/_vendor/tinymce/plugins/importcss/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.js +577 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +482 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +395 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/link/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.js +1231 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/lists/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.js +1985 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/media/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.js +2026 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +313 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/noneditable/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +316 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +354 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/paste/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.js +2935 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/preview/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.js +410 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/print/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.js +194 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/save/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.js +370 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +977 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +1419 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +419 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/table/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.js +15527 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.min.js +5 -0
- data/assets/_vendor/tinymce/plugins/template/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.js +807 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textcolor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +619 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textpattern/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +718 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/toc/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.js +559 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/css/visualblocks.css +154 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +459 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualchars/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +1325 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/wordcount/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +735 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.inline.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.mobile.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +131 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/object.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.mobile.min.css +2 -0
- data/assets/_vendor/tinymce/themes/inlite/index.js +7 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.js +18787 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.min.js +5 -0
- data/assets/_vendor/tinymce/themes/mobile/index.js +7 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.js +23384 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.min.js +8 -0
- data/assets/_vendor/tinymce/themes/modern/index.js +7 -0
- data/assets/_vendor/tinymce/themes/modern/theme.js +18311 -0
- data/assets/_vendor/tinymce/themes/modern/theme.min.js +5 -0
- data/assets/_vendor/tinymce/tinymce.js +44399 -0
- data/assets/bedrock/js/bedrock.js +16587 -6193
- data/assets/bedrock/scss/_bedrock-components.scss +16 -0
- data/assets/bedrock/scss/_bedrock-settings.scss +15 -0
- data/assets/bedrock/scss/components/attachments-grid.scss +138 -0
- data/assets/bedrock/scss/components/dropzone-upload.scss +158 -0
- data/assets/bedrock/scss/components/global.scss +16 -8
- data/assets/bedrock/scss/components/helper-classes.scss +59 -0
- data/assets/bedrock/scss/components/inline-edit-box.scss +80 -0
- data/assets/bedrock/scss/components/login-box.scss +48 -0
- data/assets/bedrock/scss/components/no-content.scss +31 -0
- data/assets/bedrock/scss/components/off-canvas-menu.scss +1 -1
- data/assets/bedrock/scss/components/page-content.scss +51 -0
- data/assets/bedrock/scss/components/reveal-panel.scss +89 -0
- data/assets/bedrock/scss/components/select-box.scss +332 -0
- data/assets/bedrock/scss/components/tiny-mce-editor.scss +14 -7
- data/lib/bedrock_sass.rb +6 -0
- data/lib/bedrock_sass/engine.rb +8 -0
- data/lib/bedrock_sass/version.rb +1 -1
- data/lib/tasks/before_assets_precompile.rake +11 -0
- metadata +188 -2
@@ -0,0 +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("5",tinymce.util.Tools.resolve),g("1",["5"],function(a){return a("tinymce.PluginManager")}),g("2",["5"],function(a){return a("tinymce.util.Tools")}),g("6",[],function(){var a=function(a,b,c){var d="UL"===b?"InsertUnorderedList":"InsertOrderedList";a.execCommand(d,!1,c===!1?null:{"list-style-type":c})};return{applyListFormat:a}}),g("3",["6"],function(a){var b=function(b){b.addCommand("ApplyUnorderedListStyle",function(c,d){a.applyListFormat(b,"UL",d["list-style-type"])}),b.addCommand("ApplyOrderedListStyle",function(c,d){a.applyListFormat(b,"OL",d["list-style-type"])})};return{register:b}}),g("7",[],function(){var a=function(a){var b=a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return b?b.split(/[ ,]/):[]},b=function(a){var b=a.getParam("advlist_bullet_styles","default,circle,disc,square");return b?b.split(/[ ,]/):[]};return{getNumberStyles:a,getBulletStyles:b}}),g("8",[],function(){var a=function(a,b){return a.$.contains(a.getBody(),b)},b=function(a){return a&&/^(TH|TD)$/.test(a.nodeName)},c=function(b){return function(c){return c&&/^(OL|UL|DL)$/.test(c.nodeName)&&a(b,c)}},d=function(a){var b=a.dom.getParent(a.selection.getNode(),"ol,ul");return a.dom.getStyle(b,"listStyleType")||""};return{isTableCellNode:b,isListNode:c,getSelectedStyleType:d}}),g("9",["2"],function(a){var b=function(a){return a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()})},c=function(c){return a.map(c,function(a){var c=b(a),d="default"===a?"":a;return{text:c,data:d}})};return{toMenuItems:c}}),g("4",["2","7","6","8","9"],function(a,b,c,d,e){var f=function(a,b){for(var c=0;c<a.length;c++){var d=a[c];if(b(d))return c}return-1},g=function(b,c){return function(e){var g=e.control;b.on("NodeChange",function(e){var h=f(e.parents,d.isTableCellNode),i=h!==-1?e.parents.slice(0,h):e.parents,j=a.grep(i,d.isListNode(b));g.active(j.length>0&&j[0].nodeName===c)})}},h=function(a){return function(b){var c=d.getSelectedStyleType(a);b.control.items().each(function(a){a.active(a.settings.data===c)})}},i=function(a,b,d,f,i,j){a.addButton(b,{active:!1,type:"splitbutton",tooltip:d,menu:e.toMenuItems(j),onPostRender:g(a,i),onshow:h(a),onselect:function(b){c.applyListFormat(a,i,b.control.settings.data)},onclick:function(){a.execCommand(f)}})},j=function(a,b,c,d,e,f){a.addButton(b,{active:!1,type:"button",tooltip:c,onPostRender:g(a,e),onclick:function(){a.execCommand(d)}})},k=function(a,b,c,d,e,f){f.length>0?i(a,b,c,d,e,f):j(a,b,c,d,e,f)},l=function(a){k(a,"numlist","Numbered list","InsertOrderedList","OL",b.getNumberStyles(a)),k(a,"bullist","Bullet list","InsertUnorderedList","UL",b.getBulletStyles(a))};return{register:l}}),g("0",["1","2","3","4"],function(a,b,c,d){return a.add("advlist",function(a){var e=function(a,c){var d=a.settings.plugins?a.settings.plugins:"";return b.inArray(d.split(/[ ,]/),c)!==-1};e(a,"lists")&&(d.register(a),c.register(a))}),function(){}}),d("0")()}();
|
@@ -0,0 +1,338 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
4
|
+
|
5
|
+
// Used when there is no 'main' module.
|
6
|
+
// The name is probably (hopefully) unique so minification removes for releases.
|
7
|
+
var register_3795 = function (id) {
|
8
|
+
var module = dem(id);
|
9
|
+
var fragments = id.split('.');
|
10
|
+
var target = Function('return this;')();
|
11
|
+
for (var i = 0; i < fragments.length - 1; ++i) {
|
12
|
+
if (target[fragments[i]] === undefined)
|
13
|
+
target[fragments[i]] = {};
|
14
|
+
target = target[fragments[i]];
|
15
|
+
}
|
16
|
+
target[fragments[fragments.length - 1]] = module;
|
17
|
+
};
|
18
|
+
|
19
|
+
var instantiate = function (id) {
|
20
|
+
var actual = defs[id];
|
21
|
+
var dependencies = actual.deps;
|
22
|
+
var definition = actual.defn;
|
23
|
+
var len = dependencies.length;
|
24
|
+
var instances = new Array(len);
|
25
|
+
for (var i = 0; i < len; ++i)
|
26
|
+
instances[i] = dem(dependencies[i]);
|
27
|
+
var defResult = definition.apply(null, instances);
|
28
|
+
if (defResult === undefined)
|
29
|
+
throw 'module [' + id + '] returned undefined';
|
30
|
+
actual.instance = defResult;
|
31
|
+
};
|
32
|
+
|
33
|
+
var def = function (id, dependencies, definition) {
|
34
|
+
if (typeof id !== 'string')
|
35
|
+
throw 'module id must be a string';
|
36
|
+
else if (dependencies === undefined)
|
37
|
+
throw 'no dependencies for ' + id;
|
38
|
+
else if (definition === undefined)
|
39
|
+
throw 'no definition function for ' + id;
|
40
|
+
defs[id] = {
|
41
|
+
deps: dependencies,
|
42
|
+
defn: definition,
|
43
|
+
instance: undefined
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
var dem = function (id) {
|
48
|
+
var actual = defs[id];
|
49
|
+
if (actual === undefined)
|
50
|
+
throw 'module [' + id + '] was undefined';
|
51
|
+
else if (actual.instance === undefined)
|
52
|
+
instantiate(id);
|
53
|
+
return actual.instance;
|
54
|
+
};
|
55
|
+
|
56
|
+
var req = function (ids, callback) {
|
57
|
+
var len = ids.length;
|
58
|
+
var instances = new Array(len);
|
59
|
+
for (var i = 0; i < len; ++i)
|
60
|
+
instances[i] = dem(ids[i]);
|
61
|
+
callback.apply(null, instances);
|
62
|
+
};
|
63
|
+
|
64
|
+
var ephox = {};
|
65
|
+
|
66
|
+
ephox.bolt = {
|
67
|
+
module: {
|
68
|
+
api: {
|
69
|
+
define: def,
|
70
|
+
require: req,
|
71
|
+
demand: dem
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
var define = def;
|
77
|
+
var require = req;
|
78
|
+
var demand = dem;
|
79
|
+
// this helps with minification when using a lot of global references
|
80
|
+
var defineGlobal = function (id, ref) {
|
81
|
+
define(id, [], function () { return ref; });
|
82
|
+
};
|
83
|
+
/*jsc
|
84
|
+
["tinymce.plugins.anchor.Plugin","tinymce.core.PluginManager","tinymce.plugins.anchor.api.Commands","tinymce.plugins.anchor.core.FilterContent","tinymce.plugins.anchor.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.anchor.ui.Dialog","tinymce.plugins.anchor.core.Anchor"]
|
85
|
+
jsc*/
|
86
|
+
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
87
|
+
/**
|
88
|
+
* ResolveGlobal.js
|
89
|
+
*
|
90
|
+
* Released under LGPL License.
|
91
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
92
|
+
*
|
93
|
+
* License: http://www.tinymce.com/license
|
94
|
+
* Contributing: http://www.tinymce.com/contributing
|
95
|
+
*/
|
96
|
+
|
97
|
+
define(
|
98
|
+
'tinymce.core.PluginManager',
|
99
|
+
[
|
100
|
+
'global!tinymce.util.Tools.resolve'
|
101
|
+
],
|
102
|
+
function (resolve) {
|
103
|
+
return resolve('tinymce.PluginManager');
|
104
|
+
}
|
105
|
+
);
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Anchor.js
|
109
|
+
*
|
110
|
+
* Released under LGPL License.
|
111
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
112
|
+
*
|
113
|
+
* License: http://www.tinymce.com/license
|
114
|
+
* Contributing: http://www.tinymce.com/contributing
|
115
|
+
*/
|
116
|
+
|
117
|
+
define(
|
118
|
+
'tinymce.plugins.anchor.core.Anchor',
|
119
|
+
[
|
120
|
+
],
|
121
|
+
function () {
|
122
|
+
var isValidId = function (id) {
|
123
|
+
// Follows HTML4 rules: https://www.w3.org/TR/html401/types.html#type-id
|
124
|
+
return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id);
|
125
|
+
};
|
126
|
+
|
127
|
+
var getId = function (editor) {
|
128
|
+
var selectedNode = editor.selection.getNode();
|
129
|
+
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
130
|
+
return isAnchor ? (selectedNode.id || selectedNode.name) : '';
|
131
|
+
};
|
132
|
+
|
133
|
+
var insert = function (editor, id) {
|
134
|
+
var selectedNode = editor.selection.getNode();
|
135
|
+
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
136
|
+
|
137
|
+
if (isAnchor) {
|
138
|
+
selectedNode.removeAttribute('name');
|
139
|
+
selectedNode.id = id;
|
140
|
+
} else {
|
141
|
+
editor.focus();
|
142
|
+
editor.selection.collapse(true);
|
143
|
+
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
|
144
|
+
id: id
|
145
|
+
}));
|
146
|
+
}
|
147
|
+
};
|
148
|
+
|
149
|
+
return {
|
150
|
+
isValidId: isValidId,
|
151
|
+
getId: getId,
|
152
|
+
insert: insert
|
153
|
+
};
|
154
|
+
}
|
155
|
+
);
|
156
|
+
/**
|
157
|
+
* Dialog.js
|
158
|
+
*
|
159
|
+
* Released under LGPL License.
|
160
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
161
|
+
*
|
162
|
+
* License: http://www.tinymce.com/license
|
163
|
+
* Contributing: http://www.tinymce.com/contributing
|
164
|
+
*/
|
165
|
+
|
166
|
+
define(
|
167
|
+
'tinymce.plugins.anchor.ui.Dialog',
|
168
|
+
[
|
169
|
+
'tinymce.plugins.anchor.core.Anchor'
|
170
|
+
],
|
171
|
+
function (Anchor) {
|
172
|
+
var insertAnchor = function (editor, newId) {
|
173
|
+
if (!Anchor.isValidId(newId)) {
|
174
|
+
editor.windowManager.alert(
|
175
|
+
'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.'
|
176
|
+
);
|
177
|
+
return true;
|
178
|
+
} else {
|
179
|
+
Anchor.insert(editor, newId);
|
180
|
+
return false;
|
181
|
+
}
|
182
|
+
};
|
183
|
+
|
184
|
+
var open = function (editor) {
|
185
|
+
var currentId = Anchor.getId(editor);
|
186
|
+
|
187
|
+
editor.windowManager.open({
|
188
|
+
title: 'Anchor',
|
189
|
+
body: { type: 'textbox', name: 'id', size: 40, label: 'Id', value: currentId },
|
190
|
+
onsubmit: function (e) {
|
191
|
+
var newId = e.data.id;
|
192
|
+
|
193
|
+
if (insertAnchor(editor, newId)) {
|
194
|
+
e.preventDefault();
|
195
|
+
}
|
196
|
+
}
|
197
|
+
});
|
198
|
+
};
|
199
|
+
|
200
|
+
return {
|
201
|
+
open: open
|
202
|
+
};
|
203
|
+
}
|
204
|
+
);
|
205
|
+
/**
|
206
|
+
* Commands.js
|
207
|
+
*
|
208
|
+
* Released under LGPL License.
|
209
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
210
|
+
*
|
211
|
+
* License: http://www.tinymce.com/license
|
212
|
+
* Contributing: http://www.tinymce.com/contributing
|
213
|
+
*/
|
214
|
+
|
215
|
+
define(
|
216
|
+
'tinymce.plugins.anchor.api.Commands',
|
217
|
+
[
|
218
|
+
'tinymce.plugins.anchor.ui.Dialog'
|
219
|
+
],
|
220
|
+
function (Dialog) {
|
221
|
+
var register = function (editor) {
|
222
|
+
editor.addCommand('mceAnchor', function () {
|
223
|
+
Dialog.open(editor);
|
224
|
+
});
|
225
|
+
};
|
226
|
+
|
227
|
+
return {
|
228
|
+
register: register
|
229
|
+
};
|
230
|
+
}
|
231
|
+
);
|
232
|
+
/**
|
233
|
+
* FilterContent.js
|
234
|
+
*
|
235
|
+
* Released under LGPL License.
|
236
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
237
|
+
*
|
238
|
+
* License: http://www.tinymce.com/license
|
239
|
+
* Contributing: http://www.tinymce.com/contributing
|
240
|
+
*/
|
241
|
+
|
242
|
+
define(
|
243
|
+
'tinymce.plugins.anchor.core.FilterContent',
|
244
|
+
[
|
245
|
+
],
|
246
|
+
function () {
|
247
|
+
var isAnchorNode = function (node) {
|
248
|
+
return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild;
|
249
|
+
};
|
250
|
+
|
251
|
+
var setContentEditable = function (state) {
|
252
|
+
return function (nodes) {
|
253
|
+
for (var i = 0; i < nodes.length; i++) {
|
254
|
+
if (isAnchorNode(nodes[i])) {
|
255
|
+
nodes[i].attr('contenteditable', state);
|
256
|
+
}
|
257
|
+
}
|
258
|
+
};
|
259
|
+
};
|
260
|
+
|
261
|
+
var setup = function (editor) {
|
262
|
+
editor.on('PreInit', function () {
|
263
|
+
editor.parser.addNodeFilter('a', setContentEditable('false'));
|
264
|
+
editor.serializer.addNodeFilter('a', setContentEditable(null));
|
265
|
+
});
|
266
|
+
};
|
267
|
+
|
268
|
+
return {
|
269
|
+
setup: setup
|
270
|
+
};
|
271
|
+
}
|
272
|
+
);
|
273
|
+
/**
|
274
|
+
* Buttons.js
|
275
|
+
*
|
276
|
+
* Released under LGPL License.
|
277
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
278
|
+
*
|
279
|
+
* License: http://www.tinymce.com/license
|
280
|
+
* Contributing: http://www.tinymce.com/contributing
|
281
|
+
*/
|
282
|
+
|
283
|
+
define(
|
284
|
+
'tinymce.plugins.anchor.ui.Buttons',
|
285
|
+
[
|
286
|
+
],
|
287
|
+
function () {
|
288
|
+
var register = function (editor) {
|
289
|
+
editor.addButton('anchor', {
|
290
|
+
icon: 'anchor',
|
291
|
+
tooltip: 'Anchor',
|
292
|
+
cmd: 'mceAnchor',
|
293
|
+
stateSelector: 'a:not([href])'
|
294
|
+
});
|
295
|
+
|
296
|
+
editor.addMenuItem('anchor', {
|
297
|
+
icon: 'anchor',
|
298
|
+
text: 'Anchor',
|
299
|
+
context: 'insert',
|
300
|
+
cmd: 'mceAnchor'
|
301
|
+
});
|
302
|
+
};
|
303
|
+
|
304
|
+
return {
|
305
|
+
register: register
|
306
|
+
};
|
307
|
+
}
|
308
|
+
);
|
309
|
+
/**
|
310
|
+
* Plugin.js
|
311
|
+
*
|
312
|
+
* Released under LGPL License.
|
313
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
314
|
+
*
|
315
|
+
* License: http://www.tinymce.com/license
|
316
|
+
* Contributing: http://www.tinymce.com/contributing
|
317
|
+
*/
|
318
|
+
|
319
|
+
define(
|
320
|
+
'tinymce.plugins.anchor.Plugin',
|
321
|
+
[
|
322
|
+
'tinymce.core.PluginManager',
|
323
|
+
'tinymce.plugins.anchor.api.Commands',
|
324
|
+
'tinymce.plugins.anchor.core.FilterContent',
|
325
|
+
'tinymce.plugins.anchor.ui.Buttons'
|
326
|
+
],
|
327
|
+
function (PluginManager, Commands, FilterContent, Buttons) {
|
328
|
+
PluginManager.add('anchor', function (editor) {
|
329
|
+
FilterContent.setup(editor);
|
330
|
+
Commands.register(editor);
|
331
|
+
Buttons.register(editor);
|
332
|
+
});
|
333
|
+
|
334
|
+
return function () { };
|
335
|
+
}
|
336
|
+
);
|
337
|
+
dem('tinymce.plugins.anchor.Plugin')();
|
338
|
+
})();
|
@@ -0,0 +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("5",tinymce.util.Tools.resolve),g("1",["5"],function(a){return a("tinymce.PluginManager")}),g("7",[],function(){var a=function(a){return/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(a)},b=function(a){var b=a.selection.getNode(),c="A"===b.tagName&&""===a.dom.getAttrib(b,"href");return c?b.id||b.name:""},c=function(a,b){var c=a.selection.getNode(),d="A"===c.tagName&&""===a.dom.getAttrib(c,"href");d?(c.removeAttribute("name"),c.id=b):(a.focus(),a.selection.collapse(!0),a.execCommand("mceInsertContent",!1,a.dom.createHTML("a",{id:b})))};return{isValidId:a,getId:b,insert:c}}),g("6",["7"],function(a){var b=function(b,c){return a.isValidId(c)?(a.insert(b,c),!1):(b.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!0)},c=function(c){var d=a.getId(c);c.windowManager.open({title:"Anchor",body:{type:"textbox",name:"id",size:40,label:"Id",value:d},onsubmit:function(a){var d=a.data.id;b(c,d)&&a.preventDefault()}})};return{open:c}}),g("2",["6"],function(a){var b=function(b){b.addCommand("mceAnchor",function(){a.open(b)})};return{register:b}}),g("3",[],function(){var a=function(a){return!a.attr("href")&&(a.attr("id")||a.attr("name"))&&!a.firstChild},b=function(b){return function(c){for(var d=0;d<c.length;d++)a(c[d])&&c[d].attr("contenteditable",b)}},c=function(a){a.on("PreInit",function(){a.parser.addNodeFilter("a",b("false")),a.serializer.addNodeFilter("a",b(null))})};return{setup:c}}),g("4",[],function(){var a=function(a){a.addButton("anchor",{icon:"anchor",tooltip:"Anchor",cmd:"mceAnchor",stateSelector:"a:not([href])"}),a.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",cmd:"mceAnchor"})};return{register:a}}),g("0",["1","2","3","4"],function(a,b,c,d){return a.add("anchor",function(a){c.setup(a),b.register(a),d.register(a)}),function(){}}),d("0")()}();
|
@@ -0,0 +1,404 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
4
|
+
|
5
|
+
// Used when there is no 'main' module.
|
6
|
+
// The name is probably (hopefully) unique so minification removes for releases.
|
7
|
+
var register_3795 = function (id) {
|
8
|
+
var module = dem(id);
|
9
|
+
var fragments = id.split('.');
|
10
|
+
var target = Function('return this;')();
|
11
|
+
for (var i = 0; i < fragments.length - 1; ++i) {
|
12
|
+
if (target[fragments[i]] === undefined)
|
13
|
+
target[fragments[i]] = {};
|
14
|
+
target = target[fragments[i]];
|
15
|
+
}
|
16
|
+
target[fragments[fragments.length - 1]] = module;
|
17
|
+
};
|
18
|
+
|
19
|
+
var instantiate = function (id) {
|
20
|
+
var actual = defs[id];
|
21
|
+
var dependencies = actual.deps;
|
22
|
+
var definition = actual.defn;
|
23
|
+
var len = dependencies.length;
|
24
|
+
var instances = new Array(len);
|
25
|
+
for (var i = 0; i < len; ++i)
|
26
|
+
instances[i] = dem(dependencies[i]);
|
27
|
+
var defResult = definition.apply(null, instances);
|
28
|
+
if (defResult === undefined)
|
29
|
+
throw 'module [' + id + '] returned undefined';
|
30
|
+
actual.instance = defResult;
|
31
|
+
};
|
32
|
+
|
33
|
+
var def = function (id, dependencies, definition) {
|
34
|
+
if (typeof id !== 'string')
|
35
|
+
throw 'module id must be a string';
|
36
|
+
else if (dependencies === undefined)
|
37
|
+
throw 'no dependencies for ' + id;
|
38
|
+
else if (definition === undefined)
|
39
|
+
throw 'no definition function for ' + id;
|
40
|
+
defs[id] = {
|
41
|
+
deps: dependencies,
|
42
|
+
defn: definition,
|
43
|
+
instance: undefined
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
var dem = function (id) {
|
48
|
+
var actual = defs[id];
|
49
|
+
if (actual === undefined)
|
50
|
+
throw 'module [' + id + '] was undefined';
|
51
|
+
else if (actual.instance === undefined)
|
52
|
+
instantiate(id);
|
53
|
+
return actual.instance;
|
54
|
+
};
|
55
|
+
|
56
|
+
var req = function (ids, callback) {
|
57
|
+
var len = ids.length;
|
58
|
+
var instances = new Array(len);
|
59
|
+
for (var i = 0; i < len; ++i)
|
60
|
+
instances[i] = dem(ids[i]);
|
61
|
+
callback.apply(null, instances);
|
62
|
+
};
|
63
|
+
|
64
|
+
var ephox = {};
|
65
|
+
|
66
|
+
ephox.bolt = {
|
67
|
+
module: {
|
68
|
+
api: {
|
69
|
+
define: def,
|
70
|
+
require: req,
|
71
|
+
demand: dem
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
var define = def;
|
77
|
+
var require = req;
|
78
|
+
var demand = dem;
|
79
|
+
// this helps with minification when using a lot of global references
|
80
|
+
var defineGlobal = function (id, ref) {
|
81
|
+
define(id, [], function () { return ref; });
|
82
|
+
};
|
83
|
+
/*jsc
|
84
|
+
["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"]
|
85
|
+
jsc*/
|
86
|
+
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
87
|
+
/**
|
88
|
+
* ResolveGlobal.js
|
89
|
+
*
|
90
|
+
* Released under LGPL License.
|
91
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
92
|
+
*
|
93
|
+
* License: http://www.tinymce.com/license
|
94
|
+
* Contributing: http://www.tinymce.com/contributing
|
95
|
+
*/
|
96
|
+
|
97
|
+
define(
|
98
|
+
'tinymce.core.Env',
|
99
|
+
[
|
100
|
+
'global!tinymce.util.Tools.resolve'
|
101
|
+
],
|
102
|
+
function (resolve) {
|
103
|
+
return resolve('tinymce.Env');
|
104
|
+
}
|
105
|
+
);
|
106
|
+
|
107
|
+
/**
|
108
|
+
* ResolveGlobal.js
|
109
|
+
*
|
110
|
+
* Released under LGPL License.
|
111
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
112
|
+
*
|
113
|
+
* License: http://www.tinymce.com/license
|
114
|
+
* Contributing: http://www.tinymce.com/contributing
|
115
|
+
*/
|
116
|
+
|
117
|
+
define(
|
118
|
+
'tinymce.core.PluginManager',
|
119
|
+
[
|
120
|
+
'global!tinymce.util.Tools.resolve'
|
121
|
+
],
|
122
|
+
function (resolve) {
|
123
|
+
return resolve('tinymce.PluginManager');
|
124
|
+
}
|
125
|
+
);
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Settings.js
|
129
|
+
*
|
130
|
+
* Released under LGPL License.
|
131
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
132
|
+
*
|
133
|
+
* License: http://www.tinymce.com/license
|
134
|
+
* Contributing: http://www.tinymce.com/contributing
|
135
|
+
*/
|
136
|
+
|
137
|
+
define(
|
138
|
+
'tinymce.plugins.autolink.api.Settings',
|
139
|
+
[
|
140
|
+
],
|
141
|
+
function () {
|
142
|
+
var getAutoLinkPattern = function (editor) {
|
143
|
+
return editor.getParam('autolink_pattern', /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i);
|
144
|
+
};
|
145
|
+
|
146
|
+
var getDefaultLinkTarget = function (editor) {
|
147
|
+
return editor.getParam('default_link_target', '');
|
148
|
+
};
|
149
|
+
|
150
|
+
return {
|
151
|
+
getAutoLinkPattern: getAutoLinkPattern,
|
152
|
+
getDefaultLinkTarget: getDefaultLinkTarget
|
153
|
+
};
|
154
|
+
}
|
155
|
+
);
|
156
|
+
/**
|
157
|
+
* Keys.js
|
158
|
+
*
|
159
|
+
* Released under LGPL License.
|
160
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
161
|
+
*
|
162
|
+
* License: http://www.tinymce.com/license
|
163
|
+
* Contributing: http://www.tinymce.com/contributing
|
164
|
+
*/
|
165
|
+
|
166
|
+
define(
|
167
|
+
'tinymce.plugins.autolink.core.Keys',
|
168
|
+
[
|
169
|
+
'tinymce.core.Env',
|
170
|
+
'tinymce.core.PluginManager',
|
171
|
+
'tinymce.plugins.autolink.api.Settings'
|
172
|
+
],
|
173
|
+
function (Env, PluginManager, Settings) {
|
174
|
+
var rangeEqualsDelimiterOrSpace = function (rangeString, delimiter) {
|
175
|
+
return rangeString === delimiter || rangeString === ' ' || rangeString.charCodeAt(0) === 160;
|
176
|
+
};
|
177
|
+
|
178
|
+
var handleEclipse = function (editor) {
|
179
|
+
parseCurrentLine(editor, -1, '(', true);
|
180
|
+
};
|
181
|
+
|
182
|
+
var handleSpacebar = function (editor) {
|
183
|
+
parseCurrentLine(editor, 0, '', true);
|
184
|
+
};
|
185
|
+
|
186
|
+
var handleEnter = function (editor) {
|
187
|
+
parseCurrentLine(editor, -1, '', false);
|
188
|
+
};
|
189
|
+
|
190
|
+
var scopeIndex = function (container, index) {
|
191
|
+
if (index < 0) {
|
192
|
+
index = 0;
|
193
|
+
}
|
194
|
+
|
195
|
+
if (container.nodeType === 3) {
|
196
|
+
var len = container.data.length;
|
197
|
+
|
198
|
+
if (index > len) {
|
199
|
+
index = len;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
return index;
|
204
|
+
};
|
205
|
+
|
206
|
+
var setStart = function (rng, container, offset) {
|
207
|
+
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
208
|
+
rng.setStart(container, scopeIndex(container, offset));
|
209
|
+
} else {
|
210
|
+
rng.setStartBefore(container);
|
211
|
+
}
|
212
|
+
};
|
213
|
+
|
214
|
+
var setEnd = function (rng, container, offset) {
|
215
|
+
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
216
|
+
rng.setEnd(container, scopeIndex(container, offset));
|
217
|
+
} else {
|
218
|
+
rng.setEndAfter(container);
|
219
|
+
}
|
220
|
+
};
|
221
|
+
|
222
|
+
var parseCurrentLine = function (editor, endOffset, delimiter) {
|
223
|
+
var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText;
|
224
|
+
var autoLinkPattern = Settings.getAutoLinkPattern(editor);
|
225
|
+
var defaultLinkTarget = Settings.getDefaultLinkTarget(editor);
|
226
|
+
|
227
|
+
// Never create a link when we are inside a link
|
228
|
+
if (editor.selection.getNode().tagName === 'A') {
|
229
|
+
return;
|
230
|
+
}
|
231
|
+
|
232
|
+
// We need at least five characters to form a URL,
|
233
|
+
// hence, at minimum, five characters from the beginning of the line.
|
234
|
+
rng = editor.selection.getRng(true).cloneRange();
|
235
|
+
if (rng.startOffset < 5) {
|
236
|
+
// During testing, the caret is placed between two text nodes.
|
237
|
+
// The previous text node contains the URL.
|
238
|
+
prev = rng.endContainer.previousSibling;
|
239
|
+
if (!prev) {
|
240
|
+
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
|
241
|
+
return;
|
242
|
+
}
|
243
|
+
|
244
|
+
prev = rng.endContainer.firstChild.nextSibling;
|
245
|
+
}
|
246
|
+
|
247
|
+
len = prev.length;
|
248
|
+
setStart(rng, prev, len);
|
249
|
+
setEnd(rng, prev, len);
|
250
|
+
|
251
|
+
if (rng.endOffset < 5) {
|
252
|
+
return;
|
253
|
+
}
|
254
|
+
|
255
|
+
end = rng.endOffset;
|
256
|
+
endContainer = prev;
|
257
|
+
} else {
|
258
|
+
endContainer = rng.endContainer;
|
259
|
+
|
260
|
+
// Get a text node
|
261
|
+
if (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
262
|
+
while (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
263
|
+
endContainer = endContainer.firstChild;
|
264
|
+
}
|
265
|
+
|
266
|
+
// Move range to text node
|
267
|
+
if (endContainer.nodeType === 3) {
|
268
|
+
setStart(rng, endContainer, 0);
|
269
|
+
setEnd(rng, endContainer, endContainer.nodeValue.length);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
if (rng.endOffset === 1) {
|
274
|
+
end = 2;
|
275
|
+
} else {
|
276
|
+
end = rng.endOffset - 1 - endOffset;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
start = end;
|
281
|
+
|
282
|
+
do {
|
283
|
+
// Move the selection one character backwards.
|
284
|
+
setStart(rng, endContainer, end >= 2 ? end - 2 : 0);
|
285
|
+
setEnd(rng, endContainer, end >= 1 ? end - 1 : 0);
|
286
|
+
end -= 1;
|
287
|
+
rngText = rng.toString();
|
288
|
+
|
289
|
+
// Loop until one of the following is found: a blank space, , delimiter, (end-2) >= 0
|
290
|
+
} while (rngText !== ' ' && rngText !== '' && rngText.charCodeAt(0) !== 160 && (end - 2) >= 0 && rngText !== delimiter);
|
291
|
+
|
292
|
+
if (rangeEqualsDelimiterOrSpace(rng.toString(), delimiter)) {
|
293
|
+
setStart(rng, endContainer, end);
|
294
|
+
setEnd(rng, endContainer, start);
|
295
|
+
end += 1;
|
296
|
+
} else if (rng.startOffset === 0) {
|
297
|
+
setStart(rng, endContainer, 0);
|
298
|
+
setEnd(rng, endContainer, start);
|
299
|
+
} else {
|
300
|
+
setStart(rng, endContainer, end);
|
301
|
+
setEnd(rng, endContainer, start);
|
302
|
+
}
|
303
|
+
|
304
|
+
// Exclude last . from word like "www.site.com."
|
305
|
+
text = rng.toString();
|
306
|
+
if (text.charAt(text.length - 1) === '.') {
|
307
|
+
setEnd(rng, endContainer, start - 1);
|
308
|
+
}
|
309
|
+
|
310
|
+
text = rng.toString().trim();
|
311
|
+
matches = text.match(autoLinkPattern);
|
312
|
+
|
313
|
+
if (matches) {
|
314
|
+
if (matches[1] === 'www.') {
|
315
|
+
matches[1] = 'http://www.';
|
316
|
+
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
317
|
+
matches[1] = 'mailto:' + matches[1];
|
318
|
+
}
|
319
|
+
|
320
|
+
bookmark = editor.selection.getBookmark();
|
321
|
+
|
322
|
+
editor.selection.setRng(rng);
|
323
|
+
editor.execCommand('createlink', false, matches[1] + matches[2]);
|
324
|
+
|
325
|
+
if (defaultLinkTarget) {
|
326
|
+
editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget);
|
327
|
+
}
|
328
|
+
|
329
|
+
editor.selection.moveToBookmark(bookmark);
|
330
|
+
editor.nodeChanged();
|
331
|
+
}
|
332
|
+
};
|
333
|
+
|
334
|
+
var setup = function (editor) {
|
335
|
+
var autoUrlDetectState;
|
336
|
+
|
337
|
+
editor.on("keydown", function (e) {
|
338
|
+
if (e.keyCode === 13) {
|
339
|
+
return handleEnter(editor);
|
340
|
+
}
|
341
|
+
});
|
342
|
+
|
343
|
+
// Internet Explorer has built-in automatic linking for most cases
|
344
|
+
if (Env.ie) {
|
345
|
+
editor.on("focus", function () {
|
346
|
+
if (!autoUrlDetectState) {
|
347
|
+
autoUrlDetectState = true;
|
348
|
+
|
349
|
+
try {
|
350
|
+
editor.execCommand('AutoUrlDetect', false, true);
|
351
|
+
} catch (ex) {
|
352
|
+
// Ignore
|
353
|
+
}
|
354
|
+
}
|
355
|
+
});
|
356
|
+
|
357
|
+
return;
|
358
|
+
}
|
359
|
+
|
360
|
+
editor.on("keypress", function (e) {
|
361
|
+
if (e.keyCode === 41) {
|
362
|
+
return handleEclipse(editor);
|
363
|
+
}
|
364
|
+
});
|
365
|
+
|
366
|
+
editor.on("keyup", function (e) {
|
367
|
+
if (e.keyCode === 32) {
|
368
|
+
return handleSpacebar(editor);
|
369
|
+
}
|
370
|
+
});
|
371
|
+
};
|
372
|
+
|
373
|
+
return {
|
374
|
+
setup: setup
|
375
|
+
};
|
376
|
+
}
|
377
|
+
);
|
378
|
+
/**
|
379
|
+
* Plugin.js
|
380
|
+
*
|
381
|
+
* Released under LGPL License.
|
382
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
383
|
+
*
|
384
|
+
* License: http://www.tinymce.com/license
|
385
|
+
* Contributing: http://www.tinymce.com/contributing
|
386
|
+
*/
|
387
|
+
|
388
|
+
define(
|
389
|
+
'tinymce.plugins.autolink.Plugin',
|
390
|
+
[
|
391
|
+
'tinymce.core.Env',
|
392
|
+
'tinymce.core.PluginManager',
|
393
|
+
'tinymce.plugins.autolink.core.Keys'
|
394
|
+
],
|
395
|
+
function (Env, PluginManager, Keys) {
|
396
|
+
PluginManager.add('autolink', function (editor) {
|
397
|
+
Keys.setup(editor);
|
398
|
+
});
|
399
|
+
|
400
|
+
return function () { };
|
401
|
+
}
|
402
|
+
);
|
403
|
+
dem('tinymce.plugins.autolink.Plugin')();
|
404
|
+
})();
|