Skip to content

Commit

Permalink
enhancement: in a each statement, ability to create a new block inclu…
Browse files Browse the repository at this point in the history
…ding abe type=data properly
  • Loading branch information
gregorybesson committed Jan 1, 2017
1 parent ca9d237 commit 1a3a97b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/server/public/abejs/scripts/modules/EditorBlock.js
Expand Up @@ -232,6 +232,7 @@ export default class EditorBlock {
var blockHtml = unescape(blockContent.textContent.replace(/\[\[([\S\s]*?)\]\]/, ''))
.replace(new RegExp(`-${dataBlock}0`, 'g'), `-${dataBlock}${newNumber}`)
.replace(/\[0\]-/g, '' + newNumber + '-')
.replace(/({{abe.*type=[\'|\"]data.*}})/g, '')
var newBlock = document.createElement('abe')
newBlock.innerHTML = blockHtml

Expand Down Expand Up @@ -306,6 +307,12 @@ export default class EditorBlock {
prevListItem.parentNode.insertBefore(newBlock, next)
this._unValueForm(newBlock)

var autocompletes = [].slice.call(newBlock.querySelectorAll('.autocomplete-result-wrapper'))
if(typeof autocompletes !== 'undefined' && autocompletes !== null && autocompletes.length > 0) {
Array.prototype.forEach.call(autocompletes, (autocomplete) => {
autocomplete.innerHTML = ''
})
}
var richs = [].slice.call(newBlock.querySelectorAll('[contenteditable]'))
if(typeof richs !== 'undefined' && richs !== null && richs.length > 0) {
Array.prototype.forEach.call(richs, (rich) => {
Expand Down

0 comments on commit 1a3a97b

Please sign in to comment.