Browse Source

Add allowScripts property to options (#35)

pull/36/head
Artur Arseniev 10 years ago
parent
commit
b80a81956a
  1. 2
      bower.json
  2. 20
      dist/grapes.min.js
  3. 2
      package.json
  4. 3
      src/editor/config/config.js
  5. 7
      src/parser/model/ParserHtml.js

2
bower.json

@ -1,7 +1,7 @@
{
"name": "grapesjs",
"description": "Open source Web Template Editor",
"version": "0.3.40",
"version": "0.3.41",
"author": "Artur Arseniev",
"homepage": "http://grapesjs.com",
"main": [

20
dist/grapes.min.js

File diff suppressed because one or more lines are too long

2
package.json

@ -1,7 +1,7 @@
{
"name": "grapesjs",
"description": "Open source Web Template Editor",
"version": "0.3.40",
"version": "0.3.41",
"author": "Artur Arseniev",
"license": "BSD-3-Clause",
"homepage": "http://grapesjs.com",

3
src/editor/config/config.js

@ -29,6 +29,9 @@ define(function () {
// Show a toolbar when the component is selected
showToolbar: 0,
// Allow script tag importing
allowScripts: 0,
// If true render a select of available devices
showDevices: 1,

7
src/parser/model/ParserHtml.js

@ -179,6 +179,7 @@ define(function(require) {
* @return {Object}
*/
parse: function(str, parserCss){
var config = (c.em && c.em.get('Config')) || {};
var res = { html: '', css: ''};
var el = document.createElement('div');
el.innerHTML = str;
@ -186,8 +187,10 @@ define(function(require) {
var i = scripts.length;
// Remove all scripts
while (i--)
scripts[i].parentNode.removeChild(scripts[i]);
if(!config.allowScripts){
while (i--)
scripts[i].parentNode.removeChild(scripts[i]);
}
// Detach style tags and parse them
if(parserCss){

Loading…
Cancel
Save