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,110 +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
|
-
/**
|
12
|
-
* This class contains the tinymce plugin logic for the paste plugin.
|
13
|
-
*
|
14
|
-
* @class tinymce.pasteplugin.Plugin
|
15
|
-
* @private
|
16
|
-
*/
|
17
|
-
define("tinymce/pasteplugin/Plugin", [
|
18
|
-
"tinymce/PluginManager",
|
19
|
-
"tinymce/pasteplugin/Clipboard",
|
20
|
-
"tinymce/pasteplugin/WordFilter",
|
21
|
-
"tinymce/pasteplugin/Quirks"
|
22
|
-
], function(PluginManager, Clipboard, WordFilter, Quirks) {
|
23
|
-
var userIsInformed;
|
24
|
-
|
25
|
-
PluginManager.add('paste', function(editor) {
|
26
|
-
var self = this, clipboard, settings = editor.settings;
|
27
|
-
|
28
|
-
function togglePlainTextPaste() {
|
29
|
-
if (clipboard.pasteFormat == "text") {
|
30
|
-
this.active(false);
|
31
|
-
clipboard.pasteFormat = "html";
|
32
|
-
} else {
|
33
|
-
clipboard.pasteFormat = "text";
|
34
|
-
this.active(true);
|
35
|
-
|
36
|
-
if (!userIsInformed) {
|
37
|
-
editor.windowManager.alert(
|
38
|
-
'Paste is now in plain text mode. Contents will now ' +
|
39
|
-
'be pasted as plain text until you toggle this option off.'
|
40
|
-
);
|
41
|
-
|
42
|
-
userIsInformed = true;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
self.clipboard = clipboard = new Clipboard(editor);
|
48
|
-
self.quirks = new Quirks(editor);
|
49
|
-
self.wordFilter = new WordFilter(editor);
|
50
|
-
|
51
|
-
if (editor.settings.paste_as_text) {
|
52
|
-
self.clipboard.pasteFormat = "text";
|
53
|
-
}
|
54
|
-
|
55
|
-
if (settings.paste_preprocess) {
|
56
|
-
editor.on('PastePreProcess', function(e) {
|
57
|
-
settings.paste_preprocess.call(self, self, e);
|
58
|
-
});
|
59
|
-
}
|
60
|
-
|
61
|
-
if (settings.paste_postprocess) {
|
62
|
-
editor.on('PastePostProcess', function(e) {
|
63
|
-
settings.paste_postprocess.call(self, self, e);
|
64
|
-
});
|
65
|
-
}
|
66
|
-
|
67
|
-
editor.addCommand('mceInsertClipboardContent', function(ui, value) {
|
68
|
-
if (value.content) {
|
69
|
-
self.clipboard.pasteHtml(value.content);
|
70
|
-
}
|
71
|
-
|
72
|
-
if (value.text) {
|
73
|
-
self.clipboard.pasteText(value.text);
|
74
|
-
}
|
75
|
-
});
|
76
|
-
|
77
|
-
// Block all drag/drop events
|
78
|
-
if (editor.paste_block_drop) {
|
79
|
-
editor.on('dragend dragover draggesture dragdrop drop drag', function(e) {
|
80
|
-
e.preventDefault();
|
81
|
-
e.stopPropagation();
|
82
|
-
});
|
83
|
-
}
|
84
|
-
|
85
|
-
// Prevent users from dropping data images on Gecko
|
86
|
-
if (!editor.settings.paste_data_images) {
|
87
|
-
editor.on('drop', function(e) {
|
88
|
-
var dataTransfer = e.dataTransfer;
|
89
|
-
|
90
|
-
if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
|
91
|
-
e.preventDefault();
|
92
|
-
}
|
93
|
-
});
|
94
|
-
}
|
95
|
-
|
96
|
-
editor.addButton('pastetext', {
|
97
|
-
icon: 'pastetext',
|
98
|
-
tooltip: 'Paste as text',
|
99
|
-
onclick: togglePlainTextPaste,
|
100
|
-
active: self.clipboard.pasteFormat == "text"
|
101
|
-
});
|
102
|
-
|
103
|
-
editor.addMenuItem('pastetext', {
|
104
|
-
text: 'Paste as text',
|
105
|
-
selectable: true,
|
106
|
-
active: clipboard.pasteFormat,
|
107
|
-
onclick: togglePlainTextPaste
|
108
|
-
});
|
109
|
-
});
|
110
|
-
});
|
@@ -1,159 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Quirks.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
|
-
/**
|
12
|
-
* This class contains various fixes for browsers. These issues can not be feature
|
13
|
-
* detected since we have no direct control over the clipboard. However we might be able
|
14
|
-
* to remove some of these fixes once the browsers gets updated/fixed.
|
15
|
-
*
|
16
|
-
* @class tinymce.pasteplugin.Quirks
|
17
|
-
* @private
|
18
|
-
*/
|
19
|
-
define("tinymce/pasteplugin/Quirks", [
|
20
|
-
"tinymce/Env",
|
21
|
-
"tinymce/util/Tools",
|
22
|
-
"tinymce/pasteplugin/WordFilter",
|
23
|
-
"tinymce/pasteplugin/Utils"
|
24
|
-
], function(Env, Tools, WordFilter, Utils) {
|
25
|
-
"use strict";
|
26
|
-
|
27
|
-
return function(editor) {
|
28
|
-
function addPreProcessFilter(filterFunc) {
|
29
|
-
editor.on('BeforePastePreProcess', function(e) {
|
30
|
-
e.content = filterFunc(e.content);
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Removes BR elements after block elements. IE9 has a nasty bug where it puts a BR element after each
|
36
|
-
* block element when pasting from word. This removes those elements.
|
37
|
-
*
|
38
|
-
* This:
|
39
|
-
* <p>a</p><br><p>b</p>
|
40
|
-
*
|
41
|
-
* Becomes:
|
42
|
-
* <p>a</p><p>b</p>
|
43
|
-
*/
|
44
|
-
function removeExplorerBrElementsAfterBlocks(html) {
|
45
|
-
// Only filter word specific content
|
46
|
-
if (!WordFilter.isWordContent(html)) {
|
47
|
-
return html;
|
48
|
-
}
|
49
|
-
|
50
|
-
// Produce block regexp based on the block elements in schema
|
51
|
-
var blockElements = [];
|
52
|
-
|
53
|
-
Tools.each(editor.schema.getBlockElements(), function(block, blockName) {
|
54
|
-
blockElements.push(blockName);
|
55
|
-
});
|
56
|
-
|
57
|
-
var explorerBlocksRegExp = new RegExp(
|
58
|
-
'(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*',
|
59
|
-
'g'
|
60
|
-
);
|
61
|
-
|
62
|
-
// Remove BR:s from: <BLOCK>X</BLOCK><BR>
|
63
|
-
html = Utils.filter(html, [
|
64
|
-
[explorerBlocksRegExp, '$1']
|
65
|
-
]);
|
66
|
-
|
67
|
-
// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
|
68
|
-
html = Utils.filter(html, [
|
69
|
-
[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
|
70
|
-
[/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
|
71
|
-
[/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
|
72
|
-
]);
|
73
|
-
|
74
|
-
return html;
|
75
|
-
}
|
76
|
-
|
77
|
-
/**
|
78
|
-
* WebKit has a nasty bug where the all computed styles gets added to style attributes when copy/pasting contents.
|
79
|
-
* This fix solves that by simply removing the whole style attribute.
|
80
|
-
*
|
81
|
-
* The paste_webkit_styles option can be set to specify what to keep:
|
82
|
-
* paste_webkit_styles: "none" // Keep no styles
|
83
|
-
* paste_webkit_styles: "all", // Keep all of them
|
84
|
-
* paste_webkit_styles: "font-weight color" // Keep specific ones
|
85
|
-
*
|
86
|
-
* @param {String} content Content that needs to be processed.
|
87
|
-
* @return {String} Processed contents.
|
88
|
-
*/
|
89
|
-
function removeWebKitStyles(content) {
|
90
|
-
// Passthrough all styles from Word and let the WordFilter handle that junk
|
91
|
-
if (WordFilter.isWordContent(content)) {
|
92
|
-
return content;
|
93
|
-
}
|
94
|
-
|
95
|
-
// Filter away styles that isn't matching the target node
|
96
|
-
var webKitStyles = editor.settings.paste_webkit_styles;
|
97
|
-
|
98
|
-
if (editor.settings.paste_remove_styles_if_webkit === false || webKitStyles == "all") {
|
99
|
-
return content;
|
100
|
-
}
|
101
|
-
|
102
|
-
if (webKitStyles) {
|
103
|
-
webKitStyles = webKitStyles.split(/[, ]/);
|
104
|
-
}
|
105
|
-
|
106
|
-
// Keep specific styles that doesn't match the current node computed style
|
107
|
-
if (webKitStyles) {
|
108
|
-
var dom = editor.dom, node = editor.selection.getNode();
|
109
|
-
|
110
|
-
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function(all, before, value, after) {
|
111
|
-
var inputStyles = dom.parseStyle(value, 'span'), outputStyles = {};
|
112
|
-
|
113
|
-
if (webKitStyles === "none") {
|
114
|
-
return before + after;
|
115
|
-
}
|
116
|
-
|
117
|
-
for (var i = 0; i < webKitStyles.length; i++) {
|
118
|
-
var inputValue = inputStyles[webKitStyles[i]], currentValue = dom.getStyle(node, webKitStyles[i], true);
|
119
|
-
|
120
|
-
if (/color/.test(webKitStyles[i])) {
|
121
|
-
inputValue = dom.toHex(inputValue);
|
122
|
-
currentValue = dom.toHex(currentValue);
|
123
|
-
}
|
124
|
-
|
125
|
-
if (currentValue != inputValue) {
|
126
|
-
outputStyles[webKitStyles[i]] = inputValue;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
outputStyles = dom.serializeStyle(outputStyles, 'span');
|
131
|
-
if (outputStyles) {
|
132
|
-
return before + ' style="' + outputStyles + '"' + after;
|
133
|
-
}
|
134
|
-
|
135
|
-
return before + after;
|
136
|
-
});
|
137
|
-
} else {
|
138
|
-
// Remove all external styles
|
139
|
-
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
|
140
|
-
}
|
141
|
-
|
142
|
-
// Keep internal styles
|
143
|
-
content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function(all, before, value, after) {
|
144
|
-
return before + ' style="' + value + '"' + after;
|
145
|
-
});
|
146
|
-
|
147
|
-
return content;
|
148
|
-
}
|
149
|
-
|
150
|
-
// Sniff browsers and apply fixes since we can't feature detect
|
151
|
-
if (Env.webkit) {
|
152
|
-
addPreProcessFilter(removeWebKitStyles);
|
153
|
-
}
|
154
|
-
|
155
|
-
if (Env.ie) {
|
156
|
-
addPreProcessFilter(removeExplorerBrElementsAfterBlocks);
|
157
|
-
}
|
158
|
-
};
|
159
|
-
});
|
@@ -1,130 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Utils.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
|
-
/**
|
12
|
-
* This class contails various utility functions for the paste plugin.
|
13
|
-
*
|
14
|
-
* @class tinymce.pasteplugin.Clipboard
|
15
|
-
* @private
|
16
|
-
*/
|
17
|
-
define("tinymce/pasteplugin/Utils", [
|
18
|
-
"tinymce/util/Tools",
|
19
|
-
"tinymce/html/DomParser",
|
20
|
-
"tinymce/html/Schema"
|
21
|
-
], function(Tools, DomParser, Schema) {
|
22
|
-
function filter(content, items) {
|
23
|
-
Tools.each(items, function(v) {
|
24
|
-
if (v.constructor == RegExp) {
|
25
|
-
content = content.replace(v, '');
|
26
|
-
} else {
|
27
|
-
content = content.replace(v[0], v[1]);
|
28
|
-
}
|
29
|
-
});
|
30
|
-
|
31
|
-
return content;
|
32
|
-
}
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Gets the innerText of the specified element. It will handle edge cases
|
36
|
-
* and works better than textContent on Gecko.
|
37
|
-
*
|
38
|
-
* @param {String} html HTML string to get text from.
|
39
|
-
* @return {String} String of text with line feeds.
|
40
|
-
*/
|
41
|
-
function innerText(html) {
|
42
|
-
var schema = new Schema(), domParser = new DomParser({}, schema), text = '';
|
43
|
-
var shortEndedElements = schema.getShortEndedElements();
|
44
|
-
var ignoreElements = Tools.makeMap('script noscript style textarea video audio iframe object', ' ');
|
45
|
-
var blockElements = schema.getBlockElements();
|
46
|
-
|
47
|
-
function walk(node) {
|
48
|
-
var name = node.name, currentNode = node;
|
49
|
-
|
50
|
-
if (name === 'br') {
|
51
|
-
text += '\n';
|
52
|
-
return;
|
53
|
-
}
|
54
|
-
|
55
|
-
// img/input/hr
|
56
|
-
if (shortEndedElements[name]) {
|
57
|
-
text += ' ';
|
58
|
-
}
|
59
|
-
|
60
|
-
// Ingore script, video contents
|
61
|
-
if (ignoreElements[name]) {
|
62
|
-
text += ' ';
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
|
66
|
-
if (node.type == 3) {
|
67
|
-
text += node.value;
|
68
|
-
}
|
69
|
-
|
70
|
-
// Walk all children
|
71
|
-
if (!node.shortEnded) {
|
72
|
-
if ((node = node.firstChild)) {
|
73
|
-
do {
|
74
|
-
walk(node);
|
75
|
-
} while ((node = node.next));
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
// Add \n or \n\n for blocks or P
|
80
|
-
if (blockElements[name] && currentNode.next) {
|
81
|
-
text += '\n';
|
82
|
-
|
83
|
-
if (name == 'p') {
|
84
|
-
text += '\n';
|
85
|
-
}
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
|
-
html = filter(html, [
|
90
|
-
/<!\[[^\]]+\]>/g // Conditional comments
|
91
|
-
]);
|
92
|
-
|
93
|
-
walk(domParser.parse(html));
|
94
|
-
|
95
|
-
return text;
|
96
|
-
}
|
97
|
-
|
98
|
-
/**
|
99
|
-
* Trims the specified HTML by removing all WebKit fragments, all elements wrapping the body trailing BR elements etc.
|
100
|
-
*
|
101
|
-
* @param {String} html Html string to trim contents on.
|
102
|
-
* @return {String} Html contents that got trimmed.
|
103
|
-
*/
|
104
|
-
function trimHtml(html) {
|
105
|
-
function trimSpaces(all, s1, s2) {
|
106
|
-
// WebKit meant to preserve multiple spaces but instead inserted around all inline tags,
|
107
|
-
// including the spans with inline styles created on paste
|
108
|
-
if (!s1 && !s2) {
|
109
|
-
return ' ';
|
110
|
-
}
|
111
|
-
|
112
|
-
return '\u00a0';
|
113
|
-
}
|
114
|
-
|
115
|
-
html = filter(html, [
|
116
|
-
/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g, // Remove anything but the contents within the BODY element
|
117
|
-
/<!--StartFragment-->|<!--EndFragment-->/g, // Inner fragments (tables from excel on mac)
|
118
|
-
[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g, trimSpaces],
|
119
|
-
/<br>$/i // Trailing BR elements
|
120
|
-
]);
|
121
|
-
|
122
|
-
return html;
|
123
|
-
}
|
124
|
-
|
125
|
-
return {
|
126
|
-
filter: filter,
|
127
|
-
innerText: innerText,
|
128
|
-
trimHtml: trimHtml
|
129
|
-
};
|
130
|
-
});
|