mirador_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +13 -0
- data/README.md +97 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/mirador_rails.rb +16 -0
- data/lib/mirador_rails/version.rb +3 -0
- data/lib/mirador_rails/view_helpers.rb +30 -0
- data/mirador_rails.gemspec +30 -0
- data/vendor/assets/images/border_type_1.png +0 -0
- data/vendor/assets/images/border_type_2.png +0 -0
- data/vendor/assets/images/border_type_3.png +0 -0
- data/vendor/assets/images/debut_dark.png +0 -0
- data/vendor/assets/javascripts/mirador.js +1 -0
- data/vendor/assets/javascripts/mirador.min.js +88 -0
- data/vendor/assets/javascripts/mirador.min.js.map +1 -0
- data/vendor/assets/locales/ar/translation.json +42 -0
- data/vendor/assets/locales/de/translation.json +77 -0
- data/vendor/assets/locales/en/translation.json +82 -0
- data/vendor/assets/locales/es/translation.json +35 -0
- data/vendor/assets/locales/fr/translation.json +77 -0
- data/vendor/assets/locales/ga/translation.json +39 -0
- data/vendor/assets/locales/ja/translation.json +82 -0
- data/vendor/assets/locales/ko/translation.json +74 -0
- data/vendor/assets/locales/nl/translation.json +39 -0
- data/vendor/assets/locales/zh-CN/translation.json +74 -0
- data/vendor/assets/locales/zh-TW/translation.json +74 -0
- data/vendor/assets/locales/zh/translation.json +74 -0
- data/vendor/assets/plugins/plugins/advlist/plugin.js +97 -0
- data/vendor/assets/plugins/plugins/advlist/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/anchor/plugin.js +45 -0
- data/vendor/assets/plugins/plugins/anchor/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/autolink/plugin.js +194 -0
- data/vendor/assets/plugins/plugins/autolink/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/autoresize/plugin.js +152 -0
- data/vendor/assets/plugins/plugins/autoresize/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/autosave/plugin.js +165 -0
- data/vendor/assets/plugins/plugins/autosave/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/bbcode/plugin.js +123 -0
- data/vendor/assets/plugins/plugins/bbcode/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/charmap/plugin.js +370 -0
- data/vendor/assets/plugins/plugins/charmap/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/code/plugin.js +60 -0
- data/vendor/assets/plugins/plugins/code/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/colorpicker/plugin.js +112 -0
- data/vendor/assets/plugins/plugins/colorpicker/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/compat3x/css/dialog.css +118 -0
- 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 +297 -0
- data/vendor/assets/plugins/plugins/compat3x/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/compat3x/tiny_mce_popup.js +542 -0
- data/vendor/assets/plugins/plugins/compat3x/utils/editable_selects.js +70 -0
- data/vendor/assets/plugins/plugins/compat3x/utils/form_utils.js +210 -0
- data/vendor/assets/plugins/plugins/compat3x/utils/mctabs.js +164 -0
- data/vendor/assets/plugins/plugins/compat3x/utils/validate.js +252 -0
- data/vendor/assets/plugins/plugins/contextmenu/plugin.js +87 -0
- data/vendor/assets/plugins/plugins/contextmenu/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/directionality/plugin.js +64 -0
- data/vendor/assets/plugins/plugins/directionality/plugin.min.js +1 -0
- 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 +65 -0
- data/vendor/assets/plugins/plugins/emoticons/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/example/dialog.html +8 -0
- data/vendor/assets/plugins/plugins/example/plugin.js +68 -0
- data/vendor/assets/plugins/plugins/example/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/example_dependency/plugin.js +22 -0
- data/vendor/assets/plugins/plugins/example_dependency/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/fullpage/plugin.js +490 -0
- data/vendor/assets/plugins/plugins/fullpage/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/fullscreen/plugin.js +136 -0
- data/vendor/assets/plugins/plugins/fullscreen/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/hr/plugin.js +30 -0
- data/vendor/assets/plugins/plugins/hr/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/image/plugin.js +439 -0
- data/vendor/assets/plugins/plugins/image/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/importcss/plugin.js +195 -0
- data/vendor/assets/plugins/plugins/importcss/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/insertdatetime/plugin.js +121 -0
- data/vendor/assets/plugins/plugins/insertdatetime/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/layer/plugin.js +225 -0
- data/vendor/assets/plugins/plugins/layer/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/legacyoutput/plugin.js +211 -0
- data/vendor/assets/plugins/plugins/legacyoutput/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/link/plugin.js +400 -0
- data/vendor/assets/plugins/plugins/link/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/lists/plugin.js +791 -0
- data/vendor/assets/plugins/plugins/lists/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/media/moxieplayer.swf +0 -0
- data/vendor/assets/plugins/plugins/media/plugin.js +774 -0
- data/vendor/assets/plugins/plugins/media/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/nonbreaking/plugin.js +53 -0
- data/vendor/assets/plugins/plugins/nonbreaking/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/noneditable/plugin.js +540 -0
- data/vendor/assets/plugins/plugins/noneditable/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/pagebreak/plugin.js +88 -0
- data/vendor/assets/plugins/plugins/pagebreak/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/paste/classes/Clipboard.js +634 -0
- data/vendor/assets/plugins/plugins/paste/classes/Plugin.js +110 -0
- data/vendor/assets/plugins/plugins/paste/classes/Quirks.js +159 -0
- data/vendor/assets/plugins/plugins/paste/classes/Utils.js +130 -0
- data/vendor/assets/plugins/plugins/paste/classes/WordFilter.js +493 -0
- data/vendor/assets/plugins/plugins/paste/plugin.dev.js +120 -0
- data/vendor/assets/plugins/plugins/paste/plugin.js +1625 -0
- data/vendor/assets/plugins/plugins/paste/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/preview/plugin.js +88 -0
- data/vendor/assets/plugins/plugins/preview/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/print/plugin.js +32 -0
- data/vendor/assets/plugins/plugins/print/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/save/plugin.js +94 -0
- data/vendor/assets/plugins/plugins/save/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/searchreplace/plugin.js +594 -0
- data/vendor/assets/plugins/plugins/searchreplace/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/spellchecker/classes/DomTextMatcher.js +470 -0
- data/vendor/assets/plugins/plugins/spellchecker/classes/Plugin.js +436 -0
- data/vendor/assets/plugins/plugins/spellchecker/plugin.dev.js +117 -0
- data/vendor/assets/plugins/plugins/spellchecker/plugin.js +996 -0
- data/vendor/assets/plugins/plugins/spellchecker/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/tabfocus/plugin.js +120 -0
- data/vendor/assets/plugins/plugins/tabfocus/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/table/classes/CellSelection.js +176 -0
- data/vendor/assets/plugins/plugins/table/classes/Dialogs.js +749 -0
- data/vendor/assets/plugins/plugins/table/classes/Plugin.js +422 -0
- data/vendor/assets/plugins/plugins/table/classes/Quirks.js +372 -0
- data/vendor/assets/plugins/plugins/table/classes/TableGrid.js +864 -0
- data/vendor/assets/plugins/plugins/table/plugin.dev.js +118 -0
- data/vendor/assets/plugins/plugins/table/plugin.js +2680 -0
- data/vendor/assets/plugins/plugins/table/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/template/plugin.js +262 -0
- data/vendor/assets/plugins/plugins/template/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/textcolor/plugin.js +272 -0
- data/vendor/assets/plugins/plugins/textcolor/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/textpattern/plugin.js +268 -0
- data/vendor/assets/plugins/plugins/textpattern/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/visualblocks/css/visualblocks.css +135 -0
- 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 +86 -0
- data/vendor/assets/plugins/plugins/visualblocks/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/visualchars/plugin.js +88 -0
- data/vendor/assets/plugins/plugins/visualchars/plugin.min.js +1 -0
- data/vendor/assets/plugins/plugins/wordcount/plugin.js +69 -0
- data/vendor/assets/plugins/plugins/wordcount/plugin.min.js +1 -0
- data/vendor/assets/skins/skins/lightgray/content.inline.min.css +1 -0
- data/vendor/assets/skins/skins/lightgray/content.min.css +1 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.svg +62 -0
- 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 +63 -0
- 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 +1 -0
- data/vendor/assets/skins/skins/lightgray/skin.min.css +1 -0
- data/vendor/assets/stylesheets/mirador-combined.css +3969 -0
- data/vendor/assets/stylesheets/mirador.css +11 -0
- data/vendor/assets/themes/themes/modern/theme.js +617 -0
- data/vendor/assets/themes/themes/modern/theme.min.js +1 -0
- metadata +318 -0
@@ -0,0 +1,87 @@
|
|
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('contextmenu', function(editor) {
|
14
|
+
var menu, contextmenuNeverUseNative = editor.settings.contextmenu_never_use_native;
|
15
|
+
|
16
|
+
editor.on('contextmenu', function(e) {
|
17
|
+
var contextmenu, doc = editor.getDoc();
|
18
|
+
|
19
|
+
// Block TinyMCE menu on ctrlKey
|
20
|
+
if (e.ctrlKey && !contextmenuNeverUseNative) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
|
24
|
+
e.preventDefault();
|
25
|
+
|
26
|
+
/**
|
27
|
+
* WebKit/Blink on Mac has the odd behavior of selecting the target word or line this causes
|
28
|
+
* issues when for example inserting images see: #7022
|
29
|
+
*/
|
30
|
+
if (tinymce.Env.mac && tinymce.Env.webkit) {
|
31
|
+
if (e.button == 2 && doc.caretRangeFromPoint) {
|
32
|
+
editor.selection.setRng(doc.caretRangeFromPoint(e.x, e.y));
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
contextmenu = editor.settings.contextmenu || 'link image inserttable | cell row column deletetable';
|
37
|
+
|
38
|
+
// Render menu
|
39
|
+
if (!menu) {
|
40
|
+
var items = [];
|
41
|
+
|
42
|
+
tinymce.each(contextmenu.split(/[ ,]/), function(name) {
|
43
|
+
var item = editor.menuItems[name];
|
44
|
+
|
45
|
+
if (name == '|') {
|
46
|
+
item = {text: name};
|
47
|
+
}
|
48
|
+
|
49
|
+
if (item) {
|
50
|
+
item.shortcut = ''; // Hide shortcuts
|
51
|
+
items.push(item);
|
52
|
+
}
|
53
|
+
});
|
54
|
+
|
55
|
+
for (var i = 0; i < items.length; i++) {
|
56
|
+
if (items[i].text == '|') {
|
57
|
+
if (i === 0 || i == items.length - 1) {
|
58
|
+
items.splice(i, 1);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
menu = new tinymce.ui.Menu({
|
64
|
+
items: items,
|
65
|
+
context: 'contextmenu'
|
66
|
+
}).addClass('contextmenu').renderTo();
|
67
|
+
|
68
|
+
editor.on('remove', function() {
|
69
|
+
menu.remove();
|
70
|
+
menu = null;
|
71
|
+
});
|
72
|
+
} else {
|
73
|
+
menu.show();
|
74
|
+
}
|
75
|
+
|
76
|
+
// Position menu
|
77
|
+
var pos = {x: e.pageX, y: e.pageY};
|
78
|
+
|
79
|
+
if (!editor.inline) {
|
80
|
+
pos = tinymce.DOM.getPos(editor.getContentAreaContainer());
|
81
|
+
pos.x += e.clientX;
|
82
|
+
pos.y += e.clientY;
|
83
|
+
}
|
84
|
+
|
85
|
+
menu.moveTo(pos.x, pos.y);
|
86
|
+
});
|
87
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("contextmenu",function(a){var b,c=a.settings.contextmenu_never_use_native;a.on("contextmenu",function(d){var e,f=a.getDoc();if(!d.ctrlKey||c){if(d.preventDefault(),tinymce.Env.mac&&tinymce.Env.webkit&&2==d.button&&f.caretRangeFromPoint&&a.selection.setRng(f.caretRangeFromPoint(d.x,d.y)),e=a.settings.contextmenu||"link image inserttable | cell row column deletetable",b)b.show();else{var g=[];tinymce.each(e.split(/[ ,]/),function(b){var c=a.menuItems[b];"|"==b&&(c={text:b}),c&&(c.shortcut="",g.push(c))});for(var h=0;h<g.length;h++)"|"==g[h].text&&(0===h||h==g.length-1)&&g.splice(h,1);b=new tinymce.ui.Menu({items:g,context:"contextmenu"}).addClass("contextmenu").renderTo(),a.on("remove",function(){b.remove(),b=null})}var i={x:d.pageX,y:d.pageY};a.inline||(i=tinymce.DOM.getPos(a.getContentAreaContainer()),i.x+=d.clientX,i.y+=d.clientY),b.moveTo(i.x,i.y)}})});
|
@@ -0,0 +1,64 @@
|
|
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('directionality', function(editor) {
|
14
|
+
function setDir(dir) {
|
15
|
+
var dom = editor.dom, curDir, blocks = editor.selection.getSelectedBlocks();
|
16
|
+
|
17
|
+
if (blocks.length) {
|
18
|
+
curDir = dom.getAttrib(blocks[0], "dir");
|
19
|
+
|
20
|
+
tinymce.each(blocks, function(block) {
|
21
|
+
// Add dir to block if the parent block doesn't already have that dir
|
22
|
+
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
|
23
|
+
if (curDir != dir) {
|
24
|
+
dom.setAttrib(block, "dir", dir);
|
25
|
+
} else {
|
26
|
+
dom.setAttrib(block, "dir", null);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
});
|
30
|
+
|
31
|
+
editor.nodeChanged();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
function generateSelector(dir) {
|
36
|
+
var selector = [];
|
37
|
+
|
38
|
+
tinymce.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function(name) {
|
39
|
+
selector.push(name + '[dir=' + dir + ']');
|
40
|
+
});
|
41
|
+
|
42
|
+
return selector.join(',');
|
43
|
+
}
|
44
|
+
|
45
|
+
editor.addCommand('mceDirectionLTR', function() {
|
46
|
+
setDir("ltr");
|
47
|
+
});
|
48
|
+
|
49
|
+
editor.addCommand('mceDirectionRTL', function() {
|
50
|
+
setDir("rtl");
|
51
|
+
});
|
52
|
+
|
53
|
+
editor.addButton('ltr', {
|
54
|
+
title: 'Left to right',
|
55
|
+
cmd: 'mceDirectionLTR',
|
56
|
+
stateSelector: generateSelector('ltr')
|
57
|
+
});
|
58
|
+
|
59
|
+
editor.addButton('rtl', {
|
60
|
+
title: 'Right to left',
|
61
|
+
cmd: 'mceDirectionRTL',
|
62
|
+
stateSelector: generateSelector('rtl')
|
63
|
+
});
|
64
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("directionality",function(a){function b(b){var c,d=a.dom,e=a.selection.getSelectedBlocks();e.length&&(c=d.getAttrib(e[0],"dir"),tinymce.each(e,function(a){d.getParent(a.parentNode,"*[dir='"+b+"']",d.getRoot())||(c!=b?d.setAttrib(a,"dir",b):d.setAttrib(a,"dir",null))}),a.nodeChanged())}function c(a){var b=[];return tinymce.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(c){b.push(c+"[dir="+a+"]")}),b.join(",")}a.addCommand("mceDirectionLTR",function(){b("ltr")}),a.addCommand("mceDirectionRTL",function(){b("rtl")}),a.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:c("ltr")}),a.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:c("rtl")})});
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,65 @@
|
|
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('emoticons', function(editor, url) {
|
14
|
+
var emoticons = [
|
15
|
+
["cool", "cry", "embarassed", "foot-in-mouth"],
|
16
|
+
["frown", "innocent", "kiss", "laughing"],
|
17
|
+
["money-mouth", "sealed", "smile", "surprised"],
|
18
|
+
["tongue-out", "undecided", "wink", "yell"]
|
19
|
+
];
|
20
|
+
|
21
|
+
function getHtml() {
|
22
|
+
var emoticonsHtml;
|
23
|
+
|
24
|
+
emoticonsHtml = '<table role="list" class="mce-grid">';
|
25
|
+
|
26
|
+
tinymce.each(emoticons, function(row) {
|
27
|
+
emoticonsHtml += '<tr>';
|
28
|
+
|
29
|
+
tinymce.each(row, function(icon) {
|
30
|
+
var emoticonUrl = url + '/img/smiley-' + icon + '.gif';
|
31
|
+
|
32
|
+
emoticonsHtml += '<td><a href="#" data-mce-url="' + emoticonUrl + '" data-mce-alt="' + icon + '" tabindex="-1" ' +
|
33
|
+
'role="option" aria-label="' + icon + '"><img src="' +
|
34
|
+
emoticonUrl + '" style="width: 18px; height: 18px" role="presentation" /></a></td>';
|
35
|
+
});
|
36
|
+
|
37
|
+
emoticonsHtml += '</tr>';
|
38
|
+
});
|
39
|
+
|
40
|
+
emoticonsHtml += '</table>';
|
41
|
+
|
42
|
+
return emoticonsHtml;
|
43
|
+
}
|
44
|
+
|
45
|
+
editor.addButton('emoticons', {
|
46
|
+
type: 'panelbutton',
|
47
|
+
panel: {
|
48
|
+
role: 'application',
|
49
|
+
autohide: true,
|
50
|
+
html: getHtml,
|
51
|
+
onclick: function(e) {
|
52
|
+
var linkElm = editor.dom.getParent(e.target, 'a');
|
53
|
+
|
54
|
+
if (linkElm) {
|
55
|
+
editor.insertContent(
|
56
|
+
'<img src="' + linkElm.getAttribute('data-mce-url') + '" alt="' + linkElm.getAttribute('data-mce-alt') + '" />'
|
57
|
+
);
|
58
|
+
|
59
|
+
this.hide();
|
60
|
+
}
|
61
|
+
}
|
62
|
+
},
|
63
|
+
tooltip: 'Emoticons'
|
64
|
+
});
|
65
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("emoticons",function(a,b){function c(){var a;return a='<table role="list" class="mce-grid">',tinymce.each(d,function(c){a+="<tr>",tinymce.each(c,function(c){var d=b+"/img/smiley-"+c+".gif";a+='<td><a href="#" data-mce-url="'+d+'" data-mce-alt="'+c+'" tabindex="-1" role="option" aria-label="'+c+'"><img src="'+d+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),a+="</tr>"}),a+="</table>"}var d=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:c,onclick:function(b){var c=a.dom.getParent(b.target,"a");c&&(a.insertContent('<img src="'+c.getAttribute("data-mce-url")+'" alt="'+c.getAttribute("data-mce-alt")+'" />'),this.hide())}},tooltip:"Emoticons"})});
|
@@ -0,0 +1,68 @@
|
|
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
|
+
/*jshint unused:false */
|
12
|
+
/*global tinymce:true */
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Example plugin that adds a toolbar button and menu item.
|
16
|
+
*/
|
17
|
+
tinymce.PluginManager.add('example', function(editor, url) {
|
18
|
+
// Add a button that opens a window
|
19
|
+
editor.addButton('example', {
|
20
|
+
text: 'My button',
|
21
|
+
icon: false,
|
22
|
+
onclick: function() {
|
23
|
+
// Open window
|
24
|
+
editor.windowManager.open({
|
25
|
+
title: 'Example plugin',
|
26
|
+
body: [
|
27
|
+
{type: 'textbox', name: 'title', label: 'Title'}
|
28
|
+
],
|
29
|
+
onsubmit: function(e) {
|
30
|
+
// Insert content when the window form is submitted
|
31
|
+
editor.insertContent('Title: ' + e.data.title);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
// Adds a menu item to the tools menu
|
38
|
+
editor.addMenuItem('example', {
|
39
|
+
text: 'Example plugin',
|
40
|
+
context: 'tools',
|
41
|
+
onclick: function() {
|
42
|
+
// Open window with a specific url
|
43
|
+
editor.windowManager.open({
|
44
|
+
title: 'TinyMCE site',
|
45
|
+
url: url + '/dialog.html',
|
46
|
+
width: 600,
|
47
|
+
height: 400,
|
48
|
+
buttons: [
|
49
|
+
{
|
50
|
+
text: 'Insert',
|
51
|
+
onclick: function() {
|
52
|
+
// Top most window object
|
53
|
+
var win = editor.windowManager.getWindows()[0];
|
54
|
+
|
55
|
+
// Insert the contents of the dialog.html textarea into the editor
|
56
|
+
editor.insertContent(win.getContentWindow().document.getElementById('content').value);
|
57
|
+
|
58
|
+
// Close the window
|
59
|
+
win.close();
|
60
|
+
}
|
61
|
+
},
|
62
|
+
|
63
|
+
{text: 'Close', onclick: 'close'}
|
64
|
+
]
|
65
|
+
});
|
66
|
+
}
|
67
|
+
});
|
68
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("example",function(a,b){a.addButton("example",{text:"My button",icon:!1,onclick:function(){a.windowManager.open({title:"Example plugin",body:[{type:"textbox",name:"title",label:"Title"}],onsubmit:function(b){a.insertContent("Title: "+b.data.title)}})}}),a.addMenuItem("example",{text:"Example plugin",context:"tools",onclick:function(){a.windowManager.open({title:"TinyMCE site",url:b+"/dialog.html",width:600,height:400,buttons:[{text:"Insert",onclick:function(){var b=a.windowManager.getWindows()[0];a.insertContent(b.getContentWindow().document.getElementById("content").value),b.close()}},{text:"Close",onclick:"close"}]})}})});
|
@@ -0,0 +1,22 @@
|
|
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
|
+
/*jshint unused:false */
|
12
|
+
/*global tinymce:true */
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Register the plugin, specifying the list of the plugins that this plugin depends on. They are specified in a list,
|
16
|
+
* with the list loaded in order. plugins in this list will be initialised when this plugin is initialized. (before the
|
17
|
+
* init method is called). plugins in a depends list should typically be specified using the short name). If necessary
|
18
|
+
* this can be done with an object which has the url to the plugin and the shortname.
|
19
|
+
*/
|
20
|
+
tinymce.PluginManager.add('example_dependency', function() {
|
21
|
+
// Example logic here
|
22
|
+
}, ['example']);
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("example_dependency",function(){},["example"]);
|
@@ -0,0 +1,490 @@
|
|
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('fullpage', function(editor) {
|
14
|
+
var each = tinymce.each, Node = tinymce.html.Node;
|
15
|
+
var head, foot;
|
16
|
+
|
17
|
+
function showDialog() {
|
18
|
+
var data = htmlToData();
|
19
|
+
|
20
|
+
editor.windowManager.open({
|
21
|
+
title: 'Document properties',
|
22
|
+
data: data,
|
23
|
+
defaults: {type: 'textbox', size: 40},
|
24
|
+
body: [
|
25
|
+
{name: 'title', label: 'Title'},
|
26
|
+
{name: 'keywords', label: 'Keywords'},
|
27
|
+
{name: 'description', label: 'Description'},
|
28
|
+
{name: 'robots', label: 'Robots'},
|
29
|
+
{name: 'author', label: 'Author'},
|
30
|
+
{name: 'docencoding', label: 'Encoding'}
|
31
|
+
],
|
32
|
+
onSubmit: function(e) {
|
33
|
+
dataToHtml(tinymce.extend(data, e.data));
|
34
|
+
}
|
35
|
+
});
|
36
|
+
}
|
37
|
+
|
38
|
+
function htmlToData() {
|
39
|
+
var headerFragment = parseHeader(), data = {}, elm, matches;
|
40
|
+
|
41
|
+
function getAttr(elm, name) {
|
42
|
+
var value = elm.attr(name);
|
43
|
+
|
44
|
+
return value || '';
|
45
|
+
}
|
46
|
+
|
47
|
+
// Default some values
|
48
|
+
data.fontface = editor.getParam("fullpage_default_fontface", "");
|
49
|
+
data.fontsize = editor.getParam("fullpage_default_fontsize", "");
|
50
|
+
|
51
|
+
// Parse XML PI
|
52
|
+
elm = headerFragment.firstChild;
|
53
|
+
if (elm.type == 7) {
|
54
|
+
data.xml_pi = true;
|
55
|
+
matches = /encoding="([^"]+)"/.exec(elm.value);
|
56
|
+
if (matches) {
|
57
|
+
data.docencoding = matches[1];
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
// Parse doctype
|
62
|
+
elm = headerFragment.getAll('#doctype')[0];
|
63
|
+
if (elm) {
|
64
|
+
data.doctype = '<!DOCTYPE' + elm.value + ">";
|
65
|
+
}
|
66
|
+
|
67
|
+
// Parse title element
|
68
|
+
elm = headerFragment.getAll('title')[0];
|
69
|
+
if (elm && elm.firstChild) {
|
70
|
+
data.title = elm.firstChild.value;
|
71
|
+
}
|
72
|
+
|
73
|
+
// Parse meta elements
|
74
|
+
each(headerFragment.getAll('meta'), function(meta) {
|
75
|
+
var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches;
|
76
|
+
|
77
|
+
if (name) {
|
78
|
+
data[name.toLowerCase()] = meta.attr('content');
|
79
|
+
} else if (httpEquiv == "Content-Type") {
|
80
|
+
matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
|
81
|
+
|
82
|
+
if (matches) {
|
83
|
+
data.docencoding = matches[1];
|
84
|
+
}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
// Parse html attribs
|
89
|
+
elm = headerFragment.getAll('html')[0];
|
90
|
+
if (elm) {
|
91
|
+
data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
|
92
|
+
}
|
93
|
+
|
94
|
+
// Parse stylesheets
|
95
|
+
data.stylesheets = [];
|
96
|
+
tinymce.each(headerFragment.getAll('link'), function(link) {
|
97
|
+
if (link.attr('rel') == 'stylesheet') {
|
98
|
+
data.stylesheets.push(link.attr('href'));
|
99
|
+
}
|
100
|
+
});
|
101
|
+
|
102
|
+
// Parse body parts
|
103
|
+
elm = headerFragment.getAll('body')[0];
|
104
|
+
if (elm) {
|
105
|
+
data.langdir = getAttr(elm, 'dir');
|
106
|
+
data.style = getAttr(elm, 'style');
|
107
|
+
data.visited_color = getAttr(elm, 'vlink');
|
108
|
+
data.link_color = getAttr(elm, 'link');
|
109
|
+
data.active_color = getAttr(elm, 'alink');
|
110
|
+
}
|
111
|
+
|
112
|
+
return data;
|
113
|
+
}
|
114
|
+
|
115
|
+
function dataToHtml(data) {
|
116
|
+
var headerFragment, headElement, html, elm, value, dom = editor.dom;
|
117
|
+
|
118
|
+
function setAttr(elm, name, value) {
|
119
|
+
elm.attr(name, value ? value : undefined);
|
120
|
+
}
|
121
|
+
|
122
|
+
function addHeadNode(node) {
|
123
|
+
if (headElement.firstChild) {
|
124
|
+
headElement.insert(node, headElement.firstChild);
|
125
|
+
} else {
|
126
|
+
headElement.append(node);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
headerFragment = parseHeader();
|
131
|
+
headElement = headerFragment.getAll('head')[0];
|
132
|
+
if (!headElement) {
|
133
|
+
elm = headerFragment.getAll('html')[0];
|
134
|
+
headElement = new Node('head', 1);
|
135
|
+
|
136
|
+
if (elm.firstChild) {
|
137
|
+
elm.insert(headElement, elm.firstChild, true);
|
138
|
+
} else {
|
139
|
+
elm.append(headElement);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
// Add/update/remove XML-PI
|
144
|
+
elm = headerFragment.firstChild;
|
145
|
+
if (data.xml_pi) {
|
146
|
+
value = 'version="1.0"';
|
147
|
+
|
148
|
+
if (data.docencoding) {
|
149
|
+
value += ' encoding="' + data.docencoding + '"';
|
150
|
+
}
|
151
|
+
|
152
|
+
if (elm.type != 7) {
|
153
|
+
elm = new Node('xml', 7);
|
154
|
+
headerFragment.insert(elm, headerFragment.firstChild, true);
|
155
|
+
}
|
156
|
+
|
157
|
+
elm.value = value;
|
158
|
+
} else if (elm && elm.type == 7) {
|
159
|
+
elm.remove();
|
160
|
+
}
|
161
|
+
|
162
|
+
// Add/update/remove doctype
|
163
|
+
elm = headerFragment.getAll('#doctype')[0];
|
164
|
+
if (data.doctype) {
|
165
|
+
if (!elm) {
|
166
|
+
elm = new Node('#doctype', 10);
|
167
|
+
|
168
|
+
if (data.xml_pi) {
|
169
|
+
headerFragment.insert(elm, headerFragment.firstChild);
|
170
|
+
} else {
|
171
|
+
addHeadNode(elm);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
elm.value = data.doctype.substring(9, data.doctype.length - 1);
|
176
|
+
} else if (elm) {
|
177
|
+
elm.remove();
|
178
|
+
}
|
179
|
+
|
180
|
+
// Add meta encoding
|
181
|
+
elm = null;
|
182
|
+
each(headerFragment.getAll('meta'), function(meta) {
|
183
|
+
if (meta.attr('http-equiv') == 'Content-Type') {
|
184
|
+
elm = meta;
|
185
|
+
}
|
186
|
+
});
|
187
|
+
|
188
|
+
if (data.docencoding) {
|
189
|
+
if (!elm) {
|
190
|
+
elm = new Node('meta', 1);
|
191
|
+
elm.attr('http-equiv', 'Content-Type');
|
192
|
+
elm.shortEnded = true;
|
193
|
+
addHeadNode(elm);
|
194
|
+
}
|
195
|
+
|
196
|
+
elm.attr('content', 'text/html; charset=' + data.docencoding);
|
197
|
+
} else if (elm) {
|
198
|
+
elm.remove();
|
199
|
+
}
|
200
|
+
|
201
|
+
// Add/update/remove title
|
202
|
+
elm = headerFragment.getAll('title')[0];
|
203
|
+
if (data.title) {
|
204
|
+
if (!elm) {
|
205
|
+
elm = new Node('title', 1);
|
206
|
+
addHeadNode(elm);
|
207
|
+
} else {
|
208
|
+
elm.empty();
|
209
|
+
}
|
210
|
+
|
211
|
+
elm.append(new Node('#text', 3)).value = data.title;
|
212
|
+
} else if (elm) {
|
213
|
+
elm.remove();
|
214
|
+
}
|
215
|
+
|
216
|
+
// Add/update/remove meta
|
217
|
+
each('keywords,description,author,copyright,robots'.split(','), function(name) {
|
218
|
+
var nodes = headerFragment.getAll('meta'), i, meta, value = data[name];
|
219
|
+
|
220
|
+
for (i = 0; i < nodes.length; i++) {
|
221
|
+
meta = nodes[i];
|
222
|
+
|
223
|
+
if (meta.attr('name') == name) {
|
224
|
+
if (value) {
|
225
|
+
meta.attr('content', value);
|
226
|
+
} else {
|
227
|
+
meta.remove();
|
228
|
+
}
|
229
|
+
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
if (value) {
|
235
|
+
elm = new Node('meta', 1);
|
236
|
+
elm.attr('name', name);
|
237
|
+
elm.attr('content', value);
|
238
|
+
elm.shortEnded = true;
|
239
|
+
|
240
|
+
addHeadNode(elm);
|
241
|
+
}
|
242
|
+
});
|
243
|
+
|
244
|
+
var currentStyleSheetsMap = {};
|
245
|
+
tinymce.each(headerFragment.getAll('link'), function(stylesheet) {
|
246
|
+
if (stylesheet.attr('rel') == 'stylesheet') {
|
247
|
+
currentStyleSheetsMap[stylesheet.attr('href')] = stylesheet;
|
248
|
+
}
|
249
|
+
});
|
250
|
+
|
251
|
+
// Add new
|
252
|
+
tinymce.each(data.stylesheets, function(stylesheet) {
|
253
|
+
if (!currentStyleSheetsMap[stylesheet]) {
|
254
|
+
elm = new Node('link', 1);
|
255
|
+
elm.attr({
|
256
|
+
rel: 'stylesheet',
|
257
|
+
text: 'text/css',
|
258
|
+
href: stylesheet
|
259
|
+
});
|
260
|
+
elm.shortEnded = true;
|
261
|
+
addHeadNode(elm);
|
262
|
+
}
|
263
|
+
|
264
|
+
delete currentStyleSheetsMap[stylesheet];
|
265
|
+
});
|
266
|
+
|
267
|
+
// Delete old
|
268
|
+
tinymce.each(currentStyleSheetsMap, function(stylesheet) {
|
269
|
+
stylesheet.remove();
|
270
|
+
});
|
271
|
+
|
272
|
+
// Update body attributes
|
273
|
+
elm = headerFragment.getAll('body')[0];
|
274
|
+
if (elm) {
|
275
|
+
setAttr(elm, 'dir', data.langdir);
|
276
|
+
setAttr(elm, 'style', data.style);
|
277
|
+
setAttr(elm, 'vlink', data.visited_color);
|
278
|
+
setAttr(elm, 'link', data.link_color);
|
279
|
+
setAttr(elm, 'alink', data.active_color);
|
280
|
+
|
281
|
+
// Update iframe body as well
|
282
|
+
dom.setAttribs(editor.getBody(), {
|
283
|
+
style : data.style,
|
284
|
+
dir : data.dir,
|
285
|
+
vLink : data.visited_color,
|
286
|
+
link : data.link_color,
|
287
|
+
aLink : data.active_color
|
288
|
+
});
|
289
|
+
}
|
290
|
+
|
291
|
+
// Set html attributes
|
292
|
+
elm = headerFragment.getAll('html')[0];
|
293
|
+
if (elm) {
|
294
|
+
setAttr(elm, 'lang', data.langcode);
|
295
|
+
setAttr(elm, 'xml:lang', data.langcode);
|
296
|
+
}
|
297
|
+
|
298
|
+
// No need for a head element
|
299
|
+
if (!headElement.firstChild) {
|
300
|
+
headElement.remove();
|
301
|
+
}
|
302
|
+
|
303
|
+
// Serialize header fragment and crop away body part
|
304
|
+
html = new tinymce.html.Serializer({
|
305
|
+
validate: false,
|
306
|
+
indent: true,
|
307
|
+
apply_source_formatting : true,
|
308
|
+
indent_before: 'head,html,body,meta,title,script,link,style',
|
309
|
+
indent_after: 'head,html,body,meta,title,script,link,style'
|
310
|
+
}).serialize(headerFragment);
|
311
|
+
|
312
|
+
head = html.substring(0, html.indexOf('</body>'));
|
313
|
+
}
|
314
|
+
|
315
|
+
function parseHeader() {
|
316
|
+
// Parse the contents with a DOM parser
|
317
|
+
return new tinymce.html.DomParser({
|
318
|
+
validate: false,
|
319
|
+
root_name: '#document'
|
320
|
+
}).parse(head);
|
321
|
+
}
|
322
|
+
|
323
|
+
function setContent(evt) {
|
324
|
+
var startPos, endPos, content = evt.content, headerFragment, styles = '', dom = editor.dom, elm;
|
325
|
+
|
326
|
+
if (evt.selection) {
|
327
|
+
return;
|
328
|
+
}
|
329
|
+
|
330
|
+
function low(s) {
|
331
|
+
return s.replace(/<\/?[A-Z]+/g, function(a) {
|
332
|
+
return a.toLowerCase();
|
333
|
+
});
|
334
|
+
}
|
335
|
+
|
336
|
+
// Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate
|
337
|
+
if (evt.format == 'raw' && head) {
|
338
|
+
return;
|
339
|
+
}
|
340
|
+
|
341
|
+
if (evt.source_view && editor.getParam('fullpage_hide_in_source_view')) {
|
342
|
+
return;
|
343
|
+
}
|
344
|
+
|
345
|
+
// Fixed so new document/setContent('') doesn't remove existing header/footer except when it's in source code view
|
346
|
+
if (content.length === 0 && !evt.source_view) {
|
347
|
+
content = tinymce.trim(head) + '\n' + tinymce.trim(content) + '\n' + tinymce.trim(foot);
|
348
|
+
}
|
349
|
+
|
350
|
+
// Parse out head, body and footer
|
351
|
+
content = content.replace(/<(\/?)BODY/gi, '<$1body');
|
352
|
+
startPos = content.indexOf('<body');
|
353
|
+
|
354
|
+
if (startPos != -1) {
|
355
|
+
startPos = content.indexOf('>', startPos);
|
356
|
+
head = low(content.substring(0, startPos + 1));
|
357
|
+
|
358
|
+
endPos = content.indexOf('</body', startPos);
|
359
|
+
if (endPos == -1) {
|
360
|
+
endPos = content.length;
|
361
|
+
}
|
362
|
+
|
363
|
+
evt.content = content.substring(startPos + 1, endPos);
|
364
|
+
foot = low(content.substring(endPos));
|
365
|
+
} else {
|
366
|
+
head = getDefaultHeader();
|
367
|
+
foot = '\n</body>\n</html>';
|
368
|
+
}
|
369
|
+
|
370
|
+
// Parse header and update iframe
|
371
|
+
headerFragment = parseHeader();
|
372
|
+
each(headerFragment.getAll('style'), function(node) {
|
373
|
+
if (node.firstChild) {
|
374
|
+
styles += node.firstChild.value;
|
375
|
+
}
|
376
|
+
});
|
377
|
+
|
378
|
+
elm = headerFragment.getAll('body')[0];
|
379
|
+
if (elm) {
|
380
|
+
dom.setAttribs(editor.getBody(), {
|
381
|
+
style: elm.attr('style') || '',
|
382
|
+
dir: elm.attr('dir') || '',
|
383
|
+
vLink: elm.attr('vlink') || '',
|
384
|
+
link: elm.attr('link') || '',
|
385
|
+
aLink: elm.attr('alink') || ''
|
386
|
+
});
|
387
|
+
}
|
388
|
+
|
389
|
+
dom.remove('fullpage_styles');
|
390
|
+
|
391
|
+
var headElm = editor.getDoc().getElementsByTagName('head')[0];
|
392
|
+
|
393
|
+
if (styles) {
|
394
|
+
dom.add(headElm, 'style', {
|
395
|
+
id : 'fullpage_styles'
|
396
|
+
}, styles);
|
397
|
+
|
398
|
+
// Needed for IE 6/7
|
399
|
+
elm = dom.get('fullpage_styles');
|
400
|
+
if (elm.styleSheet) {
|
401
|
+
elm.styleSheet.cssText = styles;
|
402
|
+
}
|
403
|
+
}
|
404
|
+
|
405
|
+
var currentStyleSheetsMap = {};
|
406
|
+
tinymce.each(headElm.getElementsByTagName('link'), function(stylesheet) {
|
407
|
+
if (stylesheet.rel == 'stylesheet' && stylesheet.getAttribute('data-mce-fullpage')) {
|
408
|
+
currentStyleSheetsMap[stylesheet.href] = stylesheet;
|
409
|
+
}
|
410
|
+
});
|
411
|
+
|
412
|
+
// Add new
|
413
|
+
tinymce.each(headerFragment.getAll('link'), function(stylesheet) {
|
414
|
+
var href = stylesheet.attr('href');
|
415
|
+
|
416
|
+
if (!currentStyleSheetsMap[href] && stylesheet.attr('rel') == 'stylesheet') {
|
417
|
+
dom.add(headElm, 'link', {
|
418
|
+
rel: 'stylesheet',
|
419
|
+
text: 'text/css',
|
420
|
+
href: href,
|
421
|
+
'data-mce-fullpage': '1'
|
422
|
+
});
|
423
|
+
}
|
424
|
+
|
425
|
+
delete currentStyleSheetsMap[href];
|
426
|
+
});
|
427
|
+
|
428
|
+
// Delete old
|
429
|
+
tinymce.each(currentStyleSheetsMap, function(stylesheet) {
|
430
|
+
stylesheet.parentNode.removeChild(stylesheet);
|
431
|
+
});
|
432
|
+
}
|
433
|
+
|
434
|
+
function getDefaultHeader() {
|
435
|
+
var header = '', value, styles = '';
|
436
|
+
|
437
|
+
if (editor.getParam('fullpage_default_xml_pi')) {
|
438
|
+
header += '<?xml version="1.0" encoding="' + editor.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';
|
439
|
+
}
|
440
|
+
|
441
|
+
header += editor.getParam('fullpage_default_doctype', '<!DOCTYPE html>');
|
442
|
+
header += '\n<html>\n<head>\n';
|
443
|
+
|
444
|
+
if ((value = editor.getParam('fullpage_default_title'))) {
|
445
|
+
header += '<title>' + value + '</title>\n';
|
446
|
+
}
|
447
|
+
|
448
|
+
if ((value = editor.getParam('fullpage_default_encoding'))) {
|
449
|
+
header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
|
450
|
+
}
|
451
|
+
|
452
|
+
if ((value = editor.getParam('fullpage_default_font_family'))) {
|
453
|
+
styles += 'font-family: ' + value + ';';
|
454
|
+
}
|
455
|
+
|
456
|
+
if ((value = editor.getParam('fullpage_default_font_size'))) {
|
457
|
+
styles += 'font-size: ' + value + ';';
|
458
|
+
}
|
459
|
+
|
460
|
+
if ((value = editor.getParam('fullpage_default_text_color'))) {
|
461
|
+
styles += 'color: ' + value + ';';
|
462
|
+
}
|
463
|
+
|
464
|
+
header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';
|
465
|
+
|
466
|
+
return header;
|
467
|
+
}
|
468
|
+
|
469
|
+
function getContent(evt) {
|
470
|
+
if (!evt.selection && (!evt.source_view || !editor.getParam('fullpage_hide_in_source_view'))) {
|
471
|
+
evt.content = tinymce.trim(head) + '\n' + tinymce.trim(evt.content) + '\n' + tinymce.trim(foot);
|
472
|
+
}
|
473
|
+
}
|
474
|
+
|
475
|
+
editor.addCommand('mceFullPageProperties', showDialog);
|
476
|
+
|
477
|
+
editor.addButton('fullpage', {
|
478
|
+
title: 'Document properties',
|
479
|
+
cmd : 'mceFullPageProperties'
|
480
|
+
});
|
481
|
+
|
482
|
+
editor.addMenuItem('fullpage', {
|
483
|
+
text: 'Document properties',
|
484
|
+
cmd : 'mceFullPageProperties',
|
485
|
+
context: 'file'
|
486
|
+
});
|
487
|
+
|
488
|
+
editor.on('BeforeSetContent', setContent);
|
489
|
+
editor.on('GetContent', getContent);
|
490
|
+
});
|