mirador_rails 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/app/controllers/mirador_rails/locales_controller.rb +10 -0
- data/config/routes.rb +7 -0
- data/lib/mirador_rails/exceptions.rb +6 -0
- data/lib/mirador_rails/locale.rb +24 -0
- data/lib/mirador_rails/version.rb +1 -1
- data/lib/mirador_rails.rb +9 -2
- data/mirador_rails.gemspec +3 -0
- data/tasks/mirador_rails.rake +44 -10
- data/vendor/assets/images/border_type_4.png +0 -0
- data/vendor/assets/images/border_type_5.png +0 -0
- data/vendor/assets/javascripts/mirador/mirador.js.erb +20105 -0
- data/vendor/assets/javascripts/mirador.js +4 -1
- data/vendor/assets/locales/de/translation.json +3 -0
- data/vendor/assets/locales/en/translation.json +11 -7
- data/vendor/assets/locales/ko/translation.json +18 -9
- data/vendor/assets/stylesheets/enhancements.scss +36 -0
- data/vendor/assets/stylesheets/mirador-combined.css +1488 -1642
- data/vendor/assets/stylesheets/mirador.css +1 -0
- metadata +52 -174
- data/vendor/assets/javascripts/mirador.min.js +0 -89
- data/vendor/assets/javascripts/mirador.min.js.map +0 -1
- data/vendor/assets/plugins/plugins/advlist/plugin.js +0 -97
- data/vendor/assets/plugins/plugins/advlist/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/anchor/plugin.js +0 -45
- data/vendor/assets/plugins/plugins/anchor/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/autolink/plugin.js +0 -194
- data/vendor/assets/plugins/plugins/autolink/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/autoresize/plugin.js +0 -152
- data/vendor/assets/plugins/plugins/autoresize/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/autosave/plugin.js +0 -165
- data/vendor/assets/plugins/plugins/autosave/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/bbcode/plugin.js +0 -123
- data/vendor/assets/plugins/plugins/bbcode/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/charmap/plugin.js +0 -370
- data/vendor/assets/plugins/plugins/charmap/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/code/plugin.js +0 -60
- data/vendor/assets/plugins/plugins/code/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/colorpicker/plugin.js +0 -112
- data/vendor/assets/plugins/plugins/colorpicker/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/compat3x/css/dialog.css +0 -118
- data/vendor/assets/plugins/plugins/compat3x/img/buttons.png +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/icons.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/items.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/menu_arrow.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/menu_check.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/progress.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/img/tabs.gif +0 -0
- data/vendor/assets/plugins/plugins/compat3x/plugin.js +0 -297
- data/vendor/assets/plugins/plugins/compat3x/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/compat3x/tiny_mce_popup.js +0 -542
- data/vendor/assets/plugins/plugins/compat3x/utils/editable_selects.js +0 -70
- data/vendor/assets/plugins/plugins/compat3x/utils/form_utils.js +0 -210
- data/vendor/assets/plugins/plugins/compat3x/utils/mctabs.js +0 -164
- data/vendor/assets/plugins/plugins/compat3x/utils/validate.js +0 -252
- data/vendor/assets/plugins/plugins/contextmenu/plugin.js +0 -87
- data/vendor/assets/plugins/plugins/contextmenu/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/directionality/plugin.js +0 -64
- data/vendor/assets/plugins/plugins/directionality/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/vendor/assets/plugins/plugins/emoticons/plugin.js +0 -65
- data/vendor/assets/plugins/plugins/emoticons/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/example/dialog.html +0 -8
- data/vendor/assets/plugins/plugins/example/plugin.js +0 -68
- data/vendor/assets/plugins/plugins/example/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/example_dependency/plugin.js +0 -22
- data/vendor/assets/plugins/plugins/example_dependency/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/fullpage/plugin.js +0 -490
- data/vendor/assets/plugins/plugins/fullpage/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/fullscreen/plugin.js +0 -136
- data/vendor/assets/plugins/plugins/fullscreen/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/hr/plugin.js +0 -30
- data/vendor/assets/plugins/plugins/hr/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/image/plugin.js +0 -439
- data/vendor/assets/plugins/plugins/image/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/importcss/plugin.js +0 -195
- data/vendor/assets/plugins/plugins/importcss/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/insertdatetime/plugin.js +0 -121
- data/vendor/assets/plugins/plugins/insertdatetime/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/layer/plugin.js +0 -225
- data/vendor/assets/plugins/plugins/layer/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/legacyoutput/plugin.js +0 -211
- data/vendor/assets/plugins/plugins/legacyoutput/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/link/plugin.js +0 -400
- data/vendor/assets/plugins/plugins/link/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/lists/plugin.js +0 -791
- data/vendor/assets/plugins/plugins/lists/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/media/moxieplayer.swf +0 -0
- data/vendor/assets/plugins/plugins/media/plugin.js +0 -774
- data/vendor/assets/plugins/plugins/media/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/nonbreaking/plugin.js +0 -53
- data/vendor/assets/plugins/plugins/nonbreaking/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/noneditable/plugin.js +0 -540
- data/vendor/assets/plugins/plugins/noneditable/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/pagebreak/plugin.js +0 -88
- data/vendor/assets/plugins/plugins/pagebreak/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/paste/classes/Clipboard.js +0 -634
- data/vendor/assets/plugins/plugins/paste/classes/Plugin.js +0 -110
- data/vendor/assets/plugins/plugins/paste/classes/Quirks.js +0 -159
- data/vendor/assets/plugins/plugins/paste/classes/Utils.js +0 -130
- data/vendor/assets/plugins/plugins/paste/classes/WordFilter.js +0 -493
- data/vendor/assets/plugins/plugins/paste/plugin.dev.js +0 -120
- data/vendor/assets/plugins/plugins/paste/plugin.js +0 -1625
- data/vendor/assets/plugins/plugins/paste/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/preview/plugin.js +0 -88
- data/vendor/assets/plugins/plugins/preview/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/print/plugin.js +0 -32
- data/vendor/assets/plugins/plugins/print/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/save/plugin.js +0 -94
- data/vendor/assets/plugins/plugins/save/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/searchreplace/plugin.js +0 -594
- data/vendor/assets/plugins/plugins/searchreplace/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/spellchecker/classes/DomTextMatcher.js +0 -470
- data/vendor/assets/plugins/plugins/spellchecker/classes/Plugin.js +0 -436
- data/vendor/assets/plugins/plugins/spellchecker/plugin.dev.js +0 -117
- data/vendor/assets/plugins/plugins/spellchecker/plugin.js +0 -996
- data/vendor/assets/plugins/plugins/spellchecker/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/tabfocus/plugin.js +0 -120
- data/vendor/assets/plugins/plugins/tabfocus/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/table/classes/CellSelection.js +0 -176
- data/vendor/assets/plugins/plugins/table/classes/Dialogs.js +0 -749
- data/vendor/assets/plugins/plugins/table/classes/Plugin.js +0 -422
- data/vendor/assets/plugins/plugins/table/classes/Quirks.js +0 -372
- data/vendor/assets/plugins/plugins/table/classes/TableGrid.js +0 -864
- data/vendor/assets/plugins/plugins/table/plugin.dev.js +0 -118
- data/vendor/assets/plugins/plugins/table/plugin.js +0 -2680
- data/vendor/assets/plugins/plugins/table/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/template/plugin.js +0 -262
- data/vendor/assets/plugins/plugins/template/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/textcolor/plugin.js +0 -272
- data/vendor/assets/plugins/plugins/textcolor/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/textpattern/plugin.js +0 -268
- data/vendor/assets/plugins/plugins/textpattern/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/visualblocks/css/visualblocks.css +0 -135
- data/vendor/assets/plugins/plugins/visualblocks/img/address.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/article.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/aside.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/blockquote.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/div.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/dl.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/figure.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h1.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h2.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h3.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h4.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h5.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/h6.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/hgroup.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/ol.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/p.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/pre.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/section.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/img/ul.gif +0 -0
- data/vendor/assets/plugins/plugins/visualblocks/plugin.js +0 -86
- data/vendor/assets/plugins/plugins/visualblocks/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/visualchars/plugin.js +0 -88
- data/vendor/assets/plugins/plugins/visualchars/plugin.min.js +0 -1
- data/vendor/assets/plugins/plugins/wordcount/plugin.js +0 -69
- data/vendor/assets/plugins/plugins/wordcount/plugin.min.js +0 -1
- data/vendor/assets/skins/skins/lightgray/content.inline.min.css +0 -1
- data/vendor/assets/skins/skins/lightgray/content.min.css +0 -1
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.svg +0 -62
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce.eot +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce.svg +0 -63
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce.woff +0 -0
- data/vendor/assets/skins/skins/lightgray/img/anchor.gif +0 -0
- data/vendor/assets/skins/skins/lightgray/img/loader.gif +0 -0
- data/vendor/assets/skins/skins/lightgray/img/object.gif +0 -0
- data/vendor/assets/skins/skins/lightgray/img/trans.gif +0 -0
- data/vendor/assets/skins/skins/lightgray/skin.ie7.min.css +0 -1
- data/vendor/assets/skins/skins/lightgray/skin.min.css +0 -1
- data/vendor/assets/themes/themes/modern/theme.js +0 -617
- data/vendor/assets/themes/themes/modern/theme.min.js +0 -1
@@ -1,97 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* plugin.js
|
3
|
-
*
|
4
|
-
* Copyright, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://www.tinymce.com/license
|
8
|
-
* Contributing: http://www.tinymce.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
/*global tinymce:true */
|
12
|
-
|
13
|
-
tinymce.PluginManager.add('advlist', function(editor) {
|
14
|
-
var olMenuItems, ulMenuItems, lastStyles = {};
|
15
|
-
|
16
|
-
function buildMenuItems(listName, styleValues) {
|
17
|
-
var items = [];
|
18
|
-
|
19
|
-
tinymce.each(styleValues.split(/[ ,]/), function(styleValue) {
|
20
|
-
items.push({
|
21
|
-
text: styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function(chr) {
|
22
|
-
return chr.toUpperCase();
|
23
|
-
}),
|
24
|
-
data: styleValue == 'default' ? '' : styleValue
|
25
|
-
});
|
26
|
-
});
|
27
|
-
|
28
|
-
return items;
|
29
|
-
}
|
30
|
-
|
31
|
-
olMenuItems = buildMenuItems('OL', editor.getParam(
|
32
|
-
"advlist_number_styles",
|
33
|
-
"default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman"
|
34
|
-
));
|
35
|
-
|
36
|
-
ulMenuItems = buildMenuItems('UL', editor.getParam("advlist_bullet_styles", "default,circle,disc,square"));
|
37
|
-
|
38
|
-
function applyListFormat(listName, styleValue) {
|
39
|
-
editor.undoManager.transact(function() {
|
40
|
-
var list, dom = editor.dom, sel = editor.selection;
|
41
|
-
|
42
|
-
// Check for existing list element
|
43
|
-
list = dom.getParent(sel.getNode(), 'ol,ul');
|
44
|
-
|
45
|
-
// Switch/add list type if needed
|
46
|
-
if (!list || list.nodeName != listName || styleValue === false) {
|
47
|
-
editor.execCommand(listName == 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList');
|
48
|
-
}
|
49
|
-
|
50
|
-
// Set style
|
51
|
-
styleValue = styleValue === false ? lastStyles[listName] : styleValue;
|
52
|
-
lastStyles[listName] = styleValue;
|
53
|
-
|
54
|
-
list = dom.getParent(sel.getNode(), 'ol,ul');
|
55
|
-
if (list) {
|
56
|
-
dom.setStyle(list, 'listStyleType', styleValue ? styleValue : null);
|
57
|
-
list.removeAttribute('data-mce-style');
|
58
|
-
}
|
59
|
-
|
60
|
-
editor.focus();
|
61
|
-
});
|
62
|
-
}
|
63
|
-
|
64
|
-
function updateSelection(e) {
|
65
|
-
var listStyleType = editor.dom.getStyle(editor.dom.getParent(editor.selection.getNode(), 'ol,ul'), 'listStyleType') || '';
|
66
|
-
|
67
|
-
e.control.items().each(function(ctrl) {
|
68
|
-
ctrl.active(ctrl.settings.data === listStyleType);
|
69
|
-
});
|
70
|
-
}
|
71
|
-
|
72
|
-
editor.addButton('numlist', {
|
73
|
-
type: 'splitbutton',
|
74
|
-
tooltip: 'Numbered list',
|
75
|
-
menu: olMenuItems,
|
76
|
-
onshow: updateSelection,
|
77
|
-
onselect: function(e) {
|
78
|
-
applyListFormat('OL', e.control.settings.data);
|
79
|
-
},
|
80
|
-
onclick: function() {
|
81
|
-
applyListFormat('OL', false);
|
82
|
-
}
|
83
|
-
});
|
84
|
-
|
85
|
-
editor.addButton('bullist', {
|
86
|
-
type: 'splitbutton',
|
87
|
-
tooltip: 'Bullet list',
|
88
|
-
menu: ulMenuItems,
|
89
|
-
onshow: updateSelection,
|
90
|
-
onselect: function(e) {
|
91
|
-
applyListFormat('UL', e.control.settings.data);
|
92
|
-
},
|
93
|
-
onclick: function() {
|
94
|
-
applyListFormat('UL', false);
|
95
|
-
}
|
96
|
-
});
|
97
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("advlist",function(a){function b(a,b){var c=[];return tinymce.each(b.split(/[ ,]/),function(a){c.push({text:a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()}),data:"default"==a?"":a})}),c}function c(b,c){a.undoManager.transact(function(){var d,e=a.dom,f=a.selection;d=e.getParent(f.getNode(),"ol,ul"),d&&d.nodeName==b&&c!==!1||a.execCommand("UL"==b?"InsertUnorderedList":"InsertOrderedList"),c=c===!1?g[b]:c,g[b]=c,d=e.getParent(f.getNode(),"ol,ul"),d&&(e.setStyle(d,"listStyleType",c?c:null),d.removeAttribute("data-mce-style")),a.focus()})}function d(b){var c=a.dom.getStyle(a.dom.getParent(a.selection.getNode(),"ol,ul"),"listStyleType")||"";b.control.items().each(function(a){a.active(a.settings.data===c)})}var e,f,g={};e=b("OL",a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),f=b("UL",a.getParam("advlist_bullet_styles","default,circle,disc,square")),a.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:e,onshow:d,onselect:function(a){c("OL",a.control.settings.data)},onclick:function(){c("OL",!1)}}),a.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:f,onshow:d,onselect:function(a){c("UL",a.control.settings.data)},onclick:function(){c("UL",!1)}})});
|
@@ -1,45 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* plugin.js
|
3
|
-
*
|
4
|
-
* Copyright, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://www.tinymce.com/license
|
8
|
-
* Contributing: http://www.tinymce.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
/*global tinymce:true */
|
12
|
-
|
13
|
-
tinymce.PluginManager.add('anchor', function(editor) {
|
14
|
-
function showDialog() {
|
15
|
-
var selectedNode = editor.selection.getNode(), name = '';
|
16
|
-
|
17
|
-
if (selectedNode.tagName == 'A') {
|
18
|
-
name = selectedNode.name || selectedNode.id || '';
|
19
|
-
}
|
20
|
-
|
21
|
-
editor.windowManager.open({
|
22
|
-
title: 'Anchor',
|
23
|
-
body: {type: 'textbox', name: 'name', size: 40, label: 'Name', value: name},
|
24
|
-
onsubmit: function(e) {
|
25
|
-
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
|
26
|
-
id: e.data.name
|
27
|
-
}));
|
28
|
-
}
|
29
|
-
});
|
30
|
-
}
|
31
|
-
|
32
|
-
editor.addButton('anchor', {
|
33
|
-
icon: 'anchor',
|
34
|
-
tooltip: 'Anchor',
|
35
|
-
onclick: showDialog,
|
36
|
-
stateSelector: 'a:not([href])'
|
37
|
-
});
|
38
|
-
|
39
|
-
editor.addMenuItem('anchor', {
|
40
|
-
icon: 'anchor',
|
41
|
-
text: 'Anchor',
|
42
|
-
context: 'insert',
|
43
|
-
onclick: showDialog
|
44
|
-
});
|
45
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("anchor",function(a){function b(){var b=a.selection.getNode(),c="";"A"==b.tagName&&(c=b.name||b.id||""),a.windowManager.open({title:"Anchor",body:{type:"textbox",name:"name",size:40,label:"Name",value:c},onsubmit:function(b){a.execCommand("mceInsertContent",!1,a.dom.createHTML("a",{id:b.data.name}))}})}a.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:b,stateSelector:"a:not([href])"}),a.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:b})});
|
@@ -1,194 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* plugin.js
|
3
|
-
*
|
4
|
-
* Copyright 2011, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://www.tinymce.com/license
|
8
|
-
* Contributing: http://www.tinymce.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
/*global tinymce:true */
|
12
|
-
|
13
|
-
tinymce.PluginManager.add('autolink', function(editor) {
|
14
|
-
var AutoUrlDetectState;
|
15
|
-
|
16
|
-
editor.on("keydown", function(e) {
|
17
|
-
if (e.keyCode == 13) {
|
18
|
-
return handleEnter(editor);
|
19
|
-
}
|
20
|
-
});
|
21
|
-
|
22
|
-
// Internet Explorer has built-in automatic linking for most cases
|
23
|
-
if (tinymce.Env.ie) {
|
24
|
-
editor.on("focus", function() {
|
25
|
-
if (!AutoUrlDetectState) {
|
26
|
-
AutoUrlDetectState = true;
|
27
|
-
|
28
|
-
try {
|
29
|
-
editor.execCommand('AutoUrlDetect', false, true);
|
30
|
-
} catch (ex) {
|
31
|
-
// Ignore
|
32
|
-
}
|
33
|
-
}
|
34
|
-
});
|
35
|
-
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
|
39
|
-
editor.on("keypress", function(e) {
|
40
|
-
if (e.keyCode == 41) {
|
41
|
-
return handleEclipse(editor);
|
42
|
-
}
|
43
|
-
});
|
44
|
-
|
45
|
-
editor.on("keyup", function(e) {
|
46
|
-
if (e.keyCode == 32) {
|
47
|
-
return handleSpacebar(editor);
|
48
|
-
}
|
49
|
-
});
|
50
|
-
|
51
|
-
function handleEclipse(editor) {
|
52
|
-
parseCurrentLine(editor, -1, '(', true);
|
53
|
-
}
|
54
|
-
|
55
|
-
function handleSpacebar(editor) {
|
56
|
-
parseCurrentLine(editor, 0, '', true);
|
57
|
-
}
|
58
|
-
|
59
|
-
function handleEnter(editor) {
|
60
|
-
parseCurrentLine(editor, -1, '', false);
|
61
|
-
}
|
62
|
-
|
63
|
-
function parseCurrentLine(editor, end_offset, delimiter) {
|
64
|
-
var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText;
|
65
|
-
|
66
|
-
function scopeIndex(container, index) {
|
67
|
-
if (index < 0) {
|
68
|
-
index = 0;
|
69
|
-
}
|
70
|
-
|
71
|
-
if (container.nodeType == 3) {
|
72
|
-
var len = container.data.length;
|
73
|
-
|
74
|
-
if (index > len) {
|
75
|
-
index = len;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
return index;
|
80
|
-
}
|
81
|
-
|
82
|
-
function setStart(container, offset) {
|
83
|
-
if (container.nodeType != 1 || container.hasChildNodes()) {
|
84
|
-
rng.setStart(container, scopeIndex(container, offset));
|
85
|
-
} else {
|
86
|
-
rng.setStartBefore(container);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
function setEnd(container, offset) {
|
91
|
-
if (container.nodeType != 1 || container.hasChildNodes()) {
|
92
|
-
rng.setEnd(container, scopeIndex(container, offset));
|
93
|
-
} else {
|
94
|
-
rng.setEndAfter(container);
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
// We need at least five characters to form a URL,
|
99
|
-
// hence, at minimum, five characters from the beginning of the line.
|
100
|
-
rng = editor.selection.getRng(true).cloneRange();
|
101
|
-
if (rng.startOffset < 5) {
|
102
|
-
// During testing, the caret is placed inbetween two text nodes.
|
103
|
-
// The previous text node contains the URL.
|
104
|
-
prev = rng.endContainer.previousSibling;
|
105
|
-
if (!prev) {
|
106
|
-
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
|
107
|
-
return;
|
108
|
-
}
|
109
|
-
|
110
|
-
prev = rng.endContainer.firstChild.nextSibling;
|
111
|
-
}
|
112
|
-
|
113
|
-
len = prev.length;
|
114
|
-
setStart(prev, len);
|
115
|
-
setEnd(prev, len);
|
116
|
-
|
117
|
-
if (rng.endOffset < 5) {
|
118
|
-
return;
|
119
|
-
}
|
120
|
-
|
121
|
-
end = rng.endOffset;
|
122
|
-
endContainer = prev;
|
123
|
-
} else {
|
124
|
-
endContainer = rng.endContainer;
|
125
|
-
|
126
|
-
// Get a text node
|
127
|
-
if (endContainer.nodeType != 3 && endContainer.firstChild) {
|
128
|
-
while (endContainer.nodeType != 3 && endContainer.firstChild) {
|
129
|
-
endContainer = endContainer.firstChild;
|
130
|
-
}
|
131
|
-
|
132
|
-
// Move range to text node
|
133
|
-
if (endContainer.nodeType == 3) {
|
134
|
-
setStart(endContainer, 0);
|
135
|
-
setEnd(endContainer, endContainer.nodeValue.length);
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
if (rng.endOffset == 1) {
|
140
|
-
end = 2;
|
141
|
-
} else {
|
142
|
-
end = rng.endOffset - 1 - end_offset;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
|
-
start = end;
|
147
|
-
|
148
|
-
do {
|
149
|
-
// Move the selection one character backwards.
|
150
|
-
setStart(endContainer, end >= 2 ? end - 2 : 0);
|
151
|
-
setEnd(endContainer, end >= 1 ? end - 1 : 0);
|
152
|
-
end -= 1;
|
153
|
-
rngText = rng.toString();
|
154
|
-
|
155
|
-
// Loop until one of the following is found: a blank space, , delimiter, (end-2) >= 0
|
156
|
-
} while (rngText != ' ' && rngText !== '' && rngText.charCodeAt(0) != 160 && (end - 2) >= 0 && rngText != delimiter);
|
157
|
-
|
158
|
-
if (rng.toString() == delimiter || rng.toString().charCodeAt(0) == 160) {
|
159
|
-
setStart(endContainer, end);
|
160
|
-
setEnd(endContainer, start);
|
161
|
-
end += 1;
|
162
|
-
} else if (rng.startOffset === 0) {
|
163
|
-
setStart(endContainer, 0);
|
164
|
-
setEnd(endContainer, start);
|
165
|
-
} else {
|
166
|
-
setStart(endContainer, end);
|
167
|
-
setEnd(endContainer, start);
|
168
|
-
}
|
169
|
-
|
170
|
-
// Exclude last . from word like "www.site.com."
|
171
|
-
text = rng.toString();
|
172
|
-
if (text.charAt(text.length - 1) == '.') {
|
173
|
-
setEnd(endContainer, start - 1);
|
174
|
-
}
|
175
|
-
|
176
|
-
text = rng.toString();
|
177
|
-
matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i);
|
178
|
-
|
179
|
-
if (matches) {
|
180
|
-
if (matches[1] == 'www.') {
|
181
|
-
matches[1] = 'http://www.';
|
182
|
-
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
183
|
-
matches[1] = 'mailto:' + matches[1];
|
184
|
-
}
|
185
|
-
|
186
|
-
bookmark = editor.selection.getBookmark();
|
187
|
-
|
188
|
-
editor.selection.setRng(rng);
|
189
|
-
editor.execCommand('createlink', false, matches[1] + matches[2]);
|
190
|
-
editor.selection.moveToBookmark(bookmark);
|
191
|
-
editor.nodeChanged();
|
192
|
-
}
|
193
|
-
}
|
194
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("autolink",function(a){function b(a){e(a,-1,"(",!0)}function c(a){e(a,0,"",!0)}function d(a){e(a,-1,"",!1)}function e(a,b,c){function d(a,b){if(0>b&&(b=0),3==a.nodeType){var c=a.data.length;b>c&&(b=c)}return b}function e(a,b){1!=a.nodeType||a.hasChildNodes()?g.setStart(a,d(a,b)):g.setStartBefore(a)}function f(a,b){1!=a.nodeType||a.hasChildNodes()?g.setEnd(a,d(a,b)):g.setEndAfter(a)}var g,h,i,j,k,l,m,n,o,p;if(g=a.selection.getRng(!0).cloneRange(),g.startOffset<5){if(n=g.endContainer.previousSibling,!n){if(!g.endContainer.firstChild||!g.endContainer.firstChild.nextSibling)return;n=g.endContainer.firstChild.nextSibling}if(o=n.length,e(n,o),f(n,o),g.endOffset<5)return;h=g.endOffset,j=n}else{if(j=g.endContainer,3!=j.nodeType&&j.firstChild){for(;3!=j.nodeType&&j.firstChild;)j=j.firstChild;3==j.nodeType&&(e(j,0),f(j,j.nodeValue.length))}h=1==g.endOffset?2:g.endOffset-1-b}i=h;do e(j,h>=2?h-2:0),f(j,h>=1?h-1:0),h-=1,p=g.toString();while(" "!=p&&""!==p&&160!=p.charCodeAt(0)&&h-2>=0&&p!=c);g.toString()==c||160==g.toString().charCodeAt(0)?(e(j,h),f(j,i),h+=1):0===g.startOffset?(e(j,0),f(j,i)):(e(j,h),f(j,i)),l=g.toString(),"."==l.charAt(l.length-1)&&f(j,i-1),l=g.toString(),m=l.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i),m&&("www."==m[1]?m[1]="http://www.":/@$/.test(m[1])&&!/^mailto:/.test(m[1])&&(m[1]="mailto:"+m[1]),k=a.selection.getBookmark(),a.selection.setRng(g),a.execCommand("createlink",!1,m[1]+m[2]),a.selection.moveToBookmark(k),a.nodeChanged())}var f;return a.on("keydown",function(b){return 13==b.keyCode?d(a):void 0}),tinymce.Env.ie?void a.on("focus",function(){if(!f){f=!0;try{a.execCommand("AutoUrlDetect",!1,!0)}catch(b){}}}):(a.on("keypress",function(c){return 41==c.keyCode?b(a):void 0}),void a.on("keyup",function(b){return 32==b.keyCode?c(a):void 0}))});
|
@@ -1,152 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* plugin.js
|
3
|
-
*
|
4
|
-
* Copyright, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://www.tinymce.com/license
|
8
|
-
* Contributing: http://www.tinymce.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
/*global tinymce:true */
|
12
|
-
/*eslint no-nested-ternary:0 */
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Auto Resize
|
16
|
-
*
|
17
|
-
* This plugin automatically resizes the content area to fit its content height.
|
18
|
-
* It will retain a minimum height, which is the height of the content area when
|
19
|
-
* it's initialized.
|
20
|
-
*/
|
21
|
-
tinymce.PluginManager.add('autoresize', function(editor) {
|
22
|
-
var settings = editor.settings, oldSize = 0;
|
23
|
-
|
24
|
-
function isFullscreen() {
|
25
|
-
return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
|
26
|
-
}
|
27
|
-
|
28
|
-
if (editor.settings.inline) {
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
|
32
|
-
/**
|
33
|
-
* This method gets executed each time the editor needs to resize.
|
34
|
-
*/
|
35
|
-
function resize(e) {
|
36
|
-
var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight,
|
37
|
-
marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom;
|
38
|
-
|
39
|
-
doc = editor.getDoc();
|
40
|
-
if (!doc) {
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
|
44
|
-
body = doc.body;
|
45
|
-
docElm = doc.documentElement;
|
46
|
-
resizeHeight = settings.autoresize_min_height;
|
47
|
-
|
48
|
-
if (!body || (e && e.type === "setcontent" && e.initial) || isFullscreen()) {
|
49
|
-
if (body && docElm) {
|
50
|
-
body.style.overflowY = "auto";
|
51
|
-
docElm.style.overflowY = "auto"; // Old IE
|
52
|
-
}
|
53
|
-
|
54
|
-
return;
|
55
|
-
}
|
56
|
-
|
57
|
-
// Calculate outer height of the body element using CSS styles
|
58
|
-
marginTop = editor.dom.getStyle(body, 'margin-top', true);
|
59
|
-
marginBottom = editor.dom.getStyle(body, 'margin-bottom', true);
|
60
|
-
paddingTop = editor.dom.getStyle(body, 'padding-top', true);
|
61
|
-
paddingBottom = editor.dom.getStyle(body, 'padding-bottom', true);
|
62
|
-
borderTop = editor.dom.getStyle(body, 'border-top-width', true);
|
63
|
-
borderBottom = editor.dom.getStyle(body, 'border-bottom-width', true);
|
64
|
-
myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10) +
|
65
|
-
parseInt(paddingTop, 10) + parseInt(paddingBottom, 10) +
|
66
|
-
parseInt(borderTop, 10) + parseInt(borderBottom, 10);
|
67
|
-
|
68
|
-
// Make sure we have a valid height
|
69
|
-
if (isNaN(myHeight) || myHeight <= 0) {
|
70
|
-
// Get height differently depending on the browser used
|
71
|
-
myHeight = tinymce.Env.ie ? body.scrollHeight : (tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight);
|
72
|
-
}
|
73
|
-
|
74
|
-
// Don't make it smaller than the minimum height
|
75
|
-
if (myHeight > settings.autoresize_min_height) {
|
76
|
-
resizeHeight = myHeight;
|
77
|
-
}
|
78
|
-
|
79
|
-
// If a maximum height has been defined don't exceed this height
|
80
|
-
if (settings.autoresize_max_height && myHeight > settings.autoresize_max_height) {
|
81
|
-
resizeHeight = settings.autoresize_max_height;
|
82
|
-
body.style.overflowY = "auto";
|
83
|
-
docElm.style.overflowY = "auto"; // Old IE
|
84
|
-
} else {
|
85
|
-
body.style.overflowY = "hidden";
|
86
|
-
docElm.style.overflowY = "hidden"; // Old IE
|
87
|
-
body.scrollTop = 0;
|
88
|
-
}
|
89
|
-
|
90
|
-
// Resize content element
|
91
|
-
if (resizeHeight !== oldSize) {
|
92
|
-
deltaSize = resizeHeight - oldSize;
|
93
|
-
DOM.setStyle(editor.iframeElement, 'height', resizeHeight + 'px');
|
94
|
-
oldSize = resizeHeight;
|
95
|
-
|
96
|
-
// WebKit doesn't decrease the size of the body element until the iframe gets resized
|
97
|
-
// So we need to continue to resize the iframe down until the size gets fixed
|
98
|
-
if (tinymce.isWebKit && deltaSize < 0) {
|
99
|
-
resize(e);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
/**
|
105
|
-
* Calls the resize x times in 100ms intervals. We can't wait for load events since
|
106
|
-
* the CSS files might load async.
|
107
|
-
*/
|
108
|
-
function wait(times, interval, callback) {
|
109
|
-
setTimeout(function() {
|
110
|
-
resize({});
|
111
|
-
|
112
|
-
if (times--) {
|
113
|
-
wait(times, interval, callback);
|
114
|
-
} else if (callback) {
|
115
|
-
callback();
|
116
|
-
}
|
117
|
-
}, interval);
|
118
|
-
}
|
119
|
-
|
120
|
-
// Define minimum height
|
121
|
-
settings.autoresize_min_height = parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10);
|
122
|
-
|
123
|
-
// Define maximum height
|
124
|
-
settings.autoresize_max_height = parseInt(editor.getParam('autoresize_max_height', 0), 10);
|
125
|
-
|
126
|
-
// Add padding at the bottom for better UX
|
127
|
-
editor.on("init", function() {
|
128
|
-
var overflowPadding = editor.getParam('autoresize_overflow_padding', 1);
|
129
|
-
|
130
|
-
editor.dom.setStyles(editor.getBody(), {
|
131
|
-
paddingBottom: editor.getParam('autoresize_bottom_margin', 50),
|
132
|
-
paddingLeft: overflowPadding,
|
133
|
-
paddingRight: overflowPadding
|
134
|
-
});
|
135
|
-
});
|
136
|
-
|
137
|
-
// Add appropriate listeners for resizing content area
|
138
|
-
editor.on("nodechange setcontent keyup FullscreenStateChanged", resize);
|
139
|
-
|
140
|
-
if (editor.getParam('autoresize_on_init', true)) {
|
141
|
-
editor.on('init', function() {
|
142
|
-
// Hit it 20 times in 100 ms intervals
|
143
|
-
wait(20, 100, function() {
|
144
|
-
// Hit it 5 times in 1 sec intervals
|
145
|
-
wait(5, 1000);
|
146
|
-
});
|
147
|
-
});
|
148
|
-
}
|
149
|
-
|
150
|
-
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
151
|
-
editor.addCommand('mceAutoResize', resize);
|
152
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce.PluginManager.add("autoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var g,h,i,j,k,l,m,n,o,p,q,r,s=tinymce.DOM;if(h=a.getDoc()){if(i=h.body,j=h.documentElement,k=e.autoresize_min_height,!i||d&&"setcontent"===d.type&&d.initial||b())return void(i&&j&&(i.style.overflowY="auto",j.style.overflowY="auto"));m=a.dom.getStyle(i,"margin-top",!0),n=a.dom.getStyle(i,"margin-bottom",!0),o=a.dom.getStyle(i,"padding-top",!0),p=a.dom.getStyle(i,"padding-bottom",!0),q=a.dom.getStyle(i,"border-top-width",!0),r=a.dom.getStyle(i,"border-bottom-width",!0),l=i.offsetHeight+parseInt(m,10)+parseInt(n,10)+parseInt(o,10)+parseInt(p,10)+parseInt(q,10)+parseInt(r,10),(isNaN(l)||0>=l)&&(l=tinymce.Env.ie?i.scrollHeight:tinymce.Env.webkit&&0===i.clientHeight?0:i.offsetHeight),l>e.autoresize_min_height&&(k=l),e.autoresize_max_height&&l>e.autoresize_max_height?(k=e.autoresize_max_height,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==f&&(g=k-f,s.setStyle(a.iframeElement,"height",k+"px"),f=k,tinymce.isWebKit&&0>g&&c(d))}}function d(a,b,e){setTimeout(function(){c({}),a--?d(a,b,e):e&&e()},b)}var e=a.settings,f=0;a.settings.inline||(e.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),e.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),a.on("init",function(){var b=a.getParam("autoresize_overflow_padding",1);a.dom.setStyles(a.getBody(),{paddingBottom:a.getParam("autoresize_bottom_margin",50),paddingLeft:b,paddingRight:b})}),a.on("nodechange setcontent keyup FullscreenStateChanged",c),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(20,100,function(){d(5,1e3)})}),a.addCommand("mceAutoResize",c))});
|
@@ -1,165 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* plugin.js
|
3
|
-
*
|
4
|
-
* Copyright, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://www.tinymce.com/license
|
8
|
-
* Contributing: http://www.tinymce.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
/*global tinymce:true */
|
12
|
-
|
13
|
-
// Internal unload handler will be called before the page is unloaded
|
14
|
-
// Needs to be outside the plugin since it would otherwise keep
|
15
|
-
// a reference to editor in closue scope
|
16
|
-
/*eslint no-func-assign:0 */
|
17
|
-
tinymce._beforeUnloadHandler = function() {
|
18
|
-
var msg;
|
19
|
-
|
20
|
-
tinymce.each(tinymce.editors, function(editor) {
|
21
|
-
// Store a draft for each editor instance
|
22
|
-
if (editor.plugins.autosave) {
|
23
|
-
editor.plugins.autosave.storeDraft();
|
24
|
-
}
|
25
|
-
|
26
|
-
// Setup a return message if the editor is dirty
|
27
|
-
if (!msg && editor.isDirty() && editor.getParam("autosave_ask_before_unload", true)) {
|
28
|
-
msg = editor.translate("You have unsaved changes are you sure you want to navigate away?");
|
29
|
-
}
|
30
|
-
});
|
31
|
-
|
32
|
-
return msg;
|
33
|
-
};
|
34
|
-
|
35
|
-
tinymce.PluginManager.add('autosave', function(editor) {
|
36
|
-
var settings = editor.settings, LocalStorage = tinymce.util.LocalStorage, prefix, started;
|
37
|
-
|
38
|
-
prefix = settings.autosave_prefix || 'tinymce-autosave-{path}{query}-{id}-';
|
39
|
-
prefix = prefix.replace(/\{path\}/g, document.location.pathname);
|
40
|
-
prefix = prefix.replace(/\{query\}/g, document.location.search);
|
41
|
-
prefix = prefix.replace(/\{id\}/g, editor.id);
|
42
|
-
|
43
|
-
function parseTime(time, defaultTime) {
|
44
|
-
var multipels = {
|
45
|
-
s: 1000,
|
46
|
-
m: 60000
|
47
|
-
};
|
48
|
-
|
49
|
-
time = /^(\d+)([ms]?)$/.exec('' + (time || defaultTime));
|
50
|
-
|
51
|
-
return (time[2] ? multipels[time[2]] : 1) * parseInt(time, 10);
|
52
|
-
}
|
53
|
-
|
54
|
-
function hasDraft() {
|
55
|
-
var time = parseInt(LocalStorage.getItem(prefix + "time"), 10) || 0;
|
56
|
-
|
57
|
-
if (new Date().getTime() - time > settings.autosave_retention) {
|
58
|
-
removeDraft(false);
|
59
|
-
return false;
|
60
|
-
}
|
61
|
-
|
62
|
-
return true;
|
63
|
-
}
|
64
|
-
|
65
|
-
function removeDraft(fire) {
|
66
|
-
LocalStorage.removeItem(prefix + "draft");
|
67
|
-
LocalStorage.removeItem(prefix + "time");
|
68
|
-
|
69
|
-
if (fire !== false) {
|
70
|
-
editor.fire('RemoveDraft');
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
|
-
function storeDraft() {
|
75
|
-
if (!isEmpty() && editor.isDirty()) {
|
76
|
-
LocalStorage.setItem(prefix + "draft", editor.getContent({format: 'raw', no_events: true}));
|
77
|
-
LocalStorage.setItem(prefix + "time", new Date().getTime());
|
78
|
-
editor.fire('StoreDraft');
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
function restoreDraft() {
|
83
|
-
if (hasDraft()) {
|
84
|
-
editor.setContent(LocalStorage.getItem(prefix + "draft"), {format: 'raw'});
|
85
|
-
editor.fire('RestoreDraft');
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
|
-
function startStoreDraft() {
|
90
|
-
if (!started) {
|
91
|
-
setInterval(function() {
|
92
|
-
if (!editor.removed) {
|
93
|
-
storeDraft();
|
94
|
-
}
|
95
|
-
}, settings.autosave_interval);
|
96
|
-
|
97
|
-
started = true;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
settings.autosave_interval = parseTime(settings.autosave_interval, '30s');
|
102
|
-
settings.autosave_retention = parseTime(settings.autosave_retention, '20m');
|
103
|
-
|
104
|
-
function postRender() {
|
105
|
-
var self = this;
|
106
|
-
|
107
|
-
self.disabled(!hasDraft());
|
108
|
-
|
109
|
-
editor.on('StoreDraft RestoreDraft RemoveDraft', function() {
|
110
|
-
self.disabled(!hasDraft());
|
111
|
-
});
|
112
|
-
|
113
|
-
startStoreDraft();
|
114
|
-
}
|
115
|
-
|
116
|
-
function restoreLastDraft() {
|
117
|
-
editor.undoManager.beforeChange();
|
118
|
-
restoreDraft();
|
119
|
-
removeDraft();
|
120
|
-
editor.undoManager.add();
|
121
|
-
}
|
122
|
-
|
123
|
-
editor.addButton('restoredraft', {
|
124
|
-
title: 'Restore last draft',
|
125
|
-
onclick: restoreLastDraft,
|
126
|
-
onPostRender: postRender
|
127
|
-
});
|
128
|
-
|
129
|
-
editor.addMenuItem('restoredraft', {
|
130
|
-
text: 'Restore last draft',
|
131
|
-
onclick: restoreLastDraft,
|
132
|
-
onPostRender: postRender,
|
133
|
-
context: 'file'
|
134
|
-
});
|
135
|
-
|
136
|
-
function isEmpty(html) {
|
137
|
-
var forcedRootBlockName = editor.settings.forced_root_block;
|
138
|
-
|
139
|
-
html = tinymce.trim(typeof(html) == "undefined" ? editor.getBody().innerHTML : html);
|
140
|
-
|
141
|
-
return html === '' || new RegExp(
|
142
|
-
'^<' + forcedRootBlockName + '[^>]*>((\u00a0| |[ \t]|<br[^>]*>)+?|)<\/' + forcedRootBlockName + '>|<br>$', 'i'
|
143
|
-
).test(html);
|
144
|
-
}
|
145
|
-
|
146
|
-
if (editor.settings.autosave_restore_when_empty !== false) {
|
147
|
-
editor.on('init', function() {
|
148
|
-
if (hasDraft() && isEmpty()) {
|
149
|
-
restoreDraft();
|
150
|
-
}
|
151
|
-
});
|
152
|
-
|
153
|
-
editor.on('saveContent', function() {
|
154
|
-
removeDraft();
|
155
|
-
});
|
156
|
-
}
|
157
|
-
|
158
|
-
window.onbeforeunload = tinymce._beforeUnloadHandler;
|
159
|
-
|
160
|
-
this.hasDraft = hasDraft;
|
161
|
-
this.storeDraft = storeDraft;
|
162
|
-
this.restoreDraft = restoreDraft;
|
163
|
-
this.removeDraft = removeDraft;
|
164
|
-
this.isEmpty = isEmpty;
|
165
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
tinymce._beforeUnloadHandler=function(){var a;return tinymce.each(tinymce.editors,function(b){b.plugins.autosave&&b.plugins.autosave.storeDraft(),!a&&b.isDirty()&&b.getParam("autosave_ask_before_unload",!0)&&(a=b.translate("You have unsaved changes are you sure you want to navigate away?"))}),a},tinymce.PluginManager.add("autosave",function(a){function b(a,b){var c={s:1e3,m:6e4};return a=/^(\d+)([ms]?)$/.exec(""+(a||b)),(a[2]?c[a[2]]:1)*parseInt(a,10)}function c(){var a=parseInt(n.getItem(k+"time"),10)||0;return(new Date).getTime()-a>m.autosave_retention?(d(!1),!1):!0}function d(b){n.removeItem(k+"draft"),n.removeItem(k+"time"),b!==!1&&a.fire("RemoveDraft")}function e(){!j()&&a.isDirty()&&(n.setItem(k+"draft",a.getContent({format:"raw",no_events:!0})),n.setItem(k+"time",(new Date).getTime()),a.fire("StoreDraft"))}function f(){c()&&(a.setContent(n.getItem(k+"draft"),{format:"raw"}),a.fire("RestoreDraft"))}function g(){l||(setInterval(function(){a.removed||e()},m.autosave_interval),l=!0)}function h(){var b=this;b.disabled(!c()),a.on("StoreDraft RestoreDraft RemoveDraft",function(){b.disabled(!c())}),g()}function i(){a.undoManager.beforeChange(),f(),d(),a.undoManager.add()}function j(b){var c=a.settings.forced_root_block;return b=tinymce.trim("undefined"==typeof b?a.getBody().innerHTML:b),""===b||new RegExp("^<"+c+"[^>]*>((\xa0| |[ ]|<br[^>]*>)+?|)</"+c+">|<br>$","i").test(b)}var k,l,m=a.settings,n=tinymce.util.LocalStorage;k=m.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",k=k.replace(/\{path\}/g,document.location.pathname),k=k.replace(/\{query\}/g,document.location.search),k=k.replace(/\{id\}/g,a.id),m.autosave_interval=b(m.autosave_interval,"30s"),m.autosave_retention=b(m.autosave_retention,"20m"),a.addButton("restoredraft",{title:"Restore last draft",onclick:i,onPostRender:h}),a.addMenuItem("restoredraft",{text:"Restore last draft",onclick:i,onPostRender:h,context:"file"}),a.settings.autosave_restore_when_empty!==!1&&(a.on("init",function(){c()&&j()&&f()}),a.on("saveContent",function(){d()})),window.onbeforeunload=tinymce._beforeUnloadHandler,this.hasDraft=c,this.storeDraft=e,this.restoreDraft=f,this.removeDraft=d,this.isEmpty=j});
|