Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
only skip sanitization on nodes that match div.inline
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewnuk committed Jul 29, 2014
1 parent 1907114 commit 6f1acce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
13 changes: 7 additions & 6 deletions build/onion-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6942,7 +6942,7 @@ define('scribe-plugin-link-ui',[],function () {


// Do not santiize blocks that match
if (this.config.ignoredTags[nodeName]) {
if (this.config.skipSanitization(node)) {
return;
}

Expand Down Expand Up @@ -10716,15 +10716,17 @@ define('onion-editor',[
var ctrlKey = function (event) { return event.metaKey || event.ctrlKey; };

// Allowable Tags
var tags = {}, ignoredTags = {};
var tags = {},
/* if a node running throught the sanitizer passes this test, it won't get santized true */
skipSanitization = function(node) {
return ($(node).is("div.inline"));
};

// Multiline
if (options.multiline) {
tags.p = {};
tags.br = {};
tags.hr = {};

ignoredTags.div = { class:'inline' } //ignore the contents of any div
}

// Bold
Expand Down Expand Up @@ -10803,7 +10805,7 @@ define('onion-editor',[

scribe.use(scribePluginSanitizer({
tags: tags,
ignoredTags: ignoredTags
skipSanitization: skipSanitization
}));


Expand All @@ -10815,7 +10817,6 @@ define('onion-editor',[
$(scribe.el).text().split(' ').length
);
}
wordcount();
setInterval(wordcount, 3000);
}

Expand Down
4 changes: 2 additions & 2 deletions build/onion-editor.min.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions src/js/onion-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ define('onion-editor',[
var ctrlKey = function (event) { return event.metaKey || event.ctrlKey; };

// Allowable Tags
var tags = {}, ignoredTags = {};
var tags = {},
/* if a node running throught the sanitizer passes this test, it won't get santized true */
skipSanitization = function(node) {
return ($(node).is("div.inline"));
};

// Multiline
if (options.multiline) {
tags.p = {};
tags.br = {};
tags.hr = {};

ignoredTags.div = { class:'inline' } //ignore the contents of any div
}

// Bold
Expand Down Expand Up @@ -160,7 +162,7 @@ define('onion-editor',[

scribe.use(scribePluginSanitizer({
tags: tags,
ignoredTags: ignoredTags
skipSanitization: skipSanitization
}));


Expand Down
2 changes: 1 addition & 1 deletion src/js/plugins/scribe-plugin-sanitizer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6f1acce

Please sign in to comment.