Created
August 18, 2014 19:55
-
-
Save ryankshaw/52828222c09a1cc40fe6 to your computer and use it in GitHub Desktop.
WIP diff for figuring out how to not strip <i> elements from tinyMCE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/public/javascripts/tinymce.editor_box.js b/public/javascripts/tinymce.editor_box.js | |
index dea8ef1..fa6289a 100644 | |
--- a/public/javascripts/tinymce.editor_box.js | |
+++ b/public/javascripts/tinymce.editor_box.js | |
@@ -167,7 +167,7 @@ define([ | |
theme_advanced_resizing : true, | |
theme_advanced_blockformats : "p,h2,h3,h4,pre", | |
theme_advanced_more_colors: false, | |
- extended_valid_elements : "iframe[src|width|height|name|align|style|class|sandbox]", | |
+ extended_valid_elements : "iframe[src|width|height|name|align|style|class|sandbox],+i[class]", | |
content_css: "/stylesheets_compiled/legacy_normal_contrast/vendor/instructure_style.css,/stylesheets_compiled/legacy_normal_contrast/vendor/tinymce.editor_box.css", | |
editor_css: editor_css, | |
auto_focus: options.focus ? id : null, | |
diff --git a/public/javascripts/tinymce/jscripts/tiny_mce/tiny_mce_src.js b/public/javascripts/tinymce/jscripts/tiny_mce/tiny_mce_src.js | |
index 1906bf8..2db8cff 100644 | |
--- a/public/javascripts/tinymce/jscripts/tiny_mce/tiny_mce_src.js | |
+++ b/public/javascripts/tinymce/jscripts/tiny_mce/tiny_mce_src.js | |
@@ -2800,7 +2800,7 @@ tinymce.html.Styles = function(settings, schema) { | |
ZE : 'abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height', | |
ZD : '[E][S]', | |
U : 'ul|ol|dl|menu|dir', | |
- ZC : 'p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q', | |
+ ZC : 'p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|i|K|N|Q', | |
T : 'h1|h2|h3|h4|h5|h6', | |
ZB : 'X|S|Q', | |
S : 'R|P', | |
@@ -2822,8 +2822,8 @@ tinymce.html.Styles = function(settings, schema) { | |
D : 'accesskey|tabindex|onfocus|onblur', | |
C : 'onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup', | |
B : 'lang|xml:lang|dir', | |
- A : 'id|class|style|title', | |
- AA: 'aria-label|role|aria-labelledby|aria-atomic|aria-busy|aria-controls|aria-describedby|aria-disabled|aria-dropeffect|aria-flowto|aria-grabbed|aria-haspopup|aria-hidden|aria-invalid|aria-label|aria-labelledby|aria-live|aria-owns|aria-relevant|aria-autocomplete|aria-checked|aria-disabled|aria-expanded|aria-haspopup|aria-hidden|aria-invalid|aria-label|aria-level|aria-multiline|aria-multiselectable|aria-orientation|aria-pressed|aria-readonly|aria-required|aria-selected|aria-sort|aria-valuemax|aria-valuemin|aria-valuenow|aria-valuetext' | |
+ A : 'id|class|style|title', | |
+ AA: 'aria-label|role|aria-labelledby|aria-atomic|aria-busy|aria-controls|aria-describedby|aria-disabled|aria-dropeffect|aria-flowto|aria-grabbed|aria-haspopup|aria-hidden|aria-invalid|aria-label|aria-labelledby|aria-live|aria-owns|aria-relevant|aria-autocomplete|aria-checked|aria-disabled|aria-expanded|aria-haspopup|aria-hidden|aria-invalid|aria-label|aria-level|aria-multiline|aria-multiselectable|aria-orientation|aria-pressed|aria-readonly|aria-required|aria-selected|aria-sort|aria-valuemax|aria-valuemin|aria-valuenow|aria-valuetext' | |
}, 'script[id|charset|type|language|src|defer|xml:space][]' + | |
'style[B|id|type|media|title|xml:space][]' + | |
'object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]' + | |
@@ -2841,7 +2841,7 @@ tinymce.html.Styles = function(settings, schema) { | |
'iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]' + | |
'h3[E|align][#|S]' + | |
'tt[E][#|S]' + | |
- 'i[E][#|S]' + | |
+ 'i[E][]' + | |
'b[E][#|S]' + | |
'u[E][#|S]' + | |
's[E][#|S]' + | |
@@ -2960,7 +2960,7 @@ tinymce.html.Styles = function(settings, schema) { | |
// Setup map objects | |
whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea'); | |
selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr'); | |
- shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr'); | |
+ shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr i'); | |
boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls'); | |
nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object', shortEndedElementsMap); | |
textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + | |
@@ -3219,7 +3219,7 @@ tinymce.html.Styles = function(settings, schema) { | |
// Switch these on HTML4 | |
if (settings.schema != "html5") { | |
- each(split('strong/b,em/i'), function(item) { | |
+ each(split('strong/b'), function(item) { | |
item = split(item, '/'); | |
elements[item[1]].outputName = item[0]; | |
}); | |
@@ -3229,14 +3229,14 @@ tinymce.html.Styles = function(settings, schema) { | |
elements.img.attributesDefault = [{name: 'alt', value: ''}]; | |
// Remove these if they are empty by default | |
- each(split('ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr,strong,em,b,i'), function(name) { | |
+ each(split('ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr,strong,b'), function(name) { | |
if (elements[name]) { | |
elements[name].removeEmpty = true; | |
} | |
}); | |
// Padd these by default | |
- each(split('p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption'), function(name) { | |
+ each(split('p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption,i'), function(name) { | |
elements[name].paddEmpty = true; | |
}); | |
} else | |
@@ -15251,7 +15251,7 @@ tinymce.ForceBlocks = function(editor) { | |
}, | |
removeformat : [ | |
- {selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true}, | |
+ {selector : 'b,strong,em,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true}, | |
{selector : 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true}, | |
{selector : '*', attributes : ['style', 'class'], split : false, expand : false, deep : true} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment