| @@ 204-239 (lines=36) @@ | ||
| 201 | } |
|
| 202 | lastValues += ',' |
|
| 203 | }) |
|
| 204 | lastValues = lastValues.substring(0, lastValues.length - 1) |
|
| 205 | lastValues += ']' |
|
| 206 | target.setAttribute('last-values', lastValues) |
|
| 207 | } |
|
| 208 | } |
|
| 209 | ||
| 210 | // var blockContent = IframeNode('#page-template', '.select-' + attr.id)[0] |
|
| 211 | ||
| 212 | var nodeComments = IframeCommentNode('#page-template', attr.id) |
|
| 213 | ||
| 214 | if(typeof nodeComments !== 'undefined' && nodeComments !== null && nodeComments.length > 0) { |
|
| 215 | var checked = e.target.querySelectorAll('option:checked') |
|
| 216 | var json = this._json.data |
|
| 217 | ||
| 218 | json[attr.id] = [] |
|
| 219 | Array.prototype.forEach.call(checked, (check) => { |
|
| 220 | if(check.value !== '') { |
|
| 221 | if(check.value.indexOf('{') > -1 || check.value.indexOf('[') > -1) { |
|
| 222 | json[attr.id].push(JSON.parse(check.value)) |
|
| 223 | }else { |
|
| 224 | json[attr.id].push(check.value) |
|
| 225 | } |
|
| 226 | } |
|
| 227 | }) |
|
| 228 | ||
| 229 | this._json.data = json |
|
| 230 | ||
| 231 | try { |
|
| 232 | Array.prototype.forEach.call(nodeComments, (nodeComment) => { |
|
| 233 | var blockHtml = unescape(nodeComment.textContent.replace(/\[\[([\S\s]*?)\]\]/, '')).replace(/\[0\]-/g, '[0]-') |
|
| 234 | ||
| 235 | // var blockHtml = unescape(blockContent.innerHTML).replace(/\[0\]-/g, '[0]-') |
|
| 236 | var template = Handlebars.compile(blockHtml, {noEscape: true}) |
|
| 237 | var compiled = template(this._json.data) |
|
| 238 | ||
| 239 | nodeComment.parentNode.innerHTML = compiled + `<!-- ${nodeComment.textContent} -->` |
|
| 240 | }) |
|
| 241 | } catch(e) { |
|
| 242 | console.log(e) |
|
| @@ 99-122 (lines=24) @@ | ||
| 96 | eval(`json.${id} = ${JSON.stringify(toSave)}`) |
|
| 97 | ||
| 98 | this._json.data = json |
|
| 99 | if(typeof nodeComments !== 'undefined' && nodeComments !== null && nodeComments.length > 0) { |
|
| 100 | ||
| 101 | try { |
|
| 102 | Array.prototype.forEach.call(nodeComments, (nodeComment) => { |
|
| 103 | var blockHtml = unescape(nodeComment.textContent.replace(/\[\[([\S\s]*?)\]\]/, '')).replace(/\[0\]-/g, '[0]-') |
|
| 104 | ||
| 105 | // var blockHtml = unescape(blockContent.innerHTML).replace(/\[0\]-/g, '[0]-') |
|
| 106 | var template = Handlebars.compile(blockHtml, {noEscape: true}) |
|
| 107 | var compiled = template(this._json.data) |
|
| 108 | ||
| 109 | nodeComment.parentNode.innerHTML = compiled + `<!-- ${nodeComment.textContent} -->` |
|
| 110 | }) |
|
| 111 | } catch(e) { |
|
| 112 | console.log(e) |
|
| 113 | } |
|
| 114 | ||
| 115 | }else if(typeof id !== 'undefined' && id !== null) { |
|
| 116 | if (this._currentInput.getAttribute('visible') === true) { |
|
| 117 | var nodes = EditorUtils.getNode(attr) |
|
| 118 | Array.prototype.forEach.call(nodes, (node) => { |
|
| 119 | EditorUtils.formToHtml(node, this._currentInput) |
|
| 120 | }) |
|
| 121 | } |
|
| 122 | } |
|
| 123 | ||
| 124 | this.onReload._fire() |
|
| 125 | } |
|