diff --git a/editor/src/editor.js b/editor/src/editor.js index cc37ca8..371b7b4 100644 --- a/editor/src/editor.js +++ b/editor/src/editor.js @@ -219,6 +219,7 @@ function Editor(holder, input) { if (text === undefined) { return; } + if (!scope) { scope = editor.scope || {} } @@ -264,9 +265,10 @@ function Editor(holder, input) { holder.$listEditor = editor editor.scope = {} - $(holder).find('.content input[type="checkbox"]').on('click', function (event) { + $(holder).on('click', '.content input[type="checkbox"]', function (event) { let that = this - let id = $(this).closest('.list-item').data('id') + let li = $(this).parents('.list-item'); + let id = li.attr('data-id') editor.update(id, function (item, prev, next) { if (that.checked) { item.text = item.text.replace('#[[TODO]]', '#[[DONE]]') @@ -275,8 +277,7 @@ function Editor(holder, input) { } return item }); - event.stopPropagation() - return false + return true }) editor.on('change', function () { @@ -491,7 +492,6 @@ function Editor(holder, input) { }) } -let timeout = null; let searchInput = document.getElementById('search-input'); search(searchInput).then(searcher => { let showSearch = _.debounce(function (searcher) { diff --git a/list-editor/index.js b/list-editor/index.js index 964b538..fc060d8 100644 --- a/list-editor/index.js +++ b/list-editor/index.js @@ -52,7 +52,7 @@ function editor(root, inputData, options) { function copy(element, opt) { let item = $(element).parents('.list-item') - let id = item.data('id') + let id = item.attr('data-id') if (opt.recursive) { return saveTree(id) @@ -65,7 +65,7 @@ function editor(root, inputData, options) { function zoomin(element, opt) { let item = $(element).parents('.list-item') - let id = item.data('id') + let id = item.attr('data-id') return new Promise(function (resolve, reject) { resolve(id); }); @@ -134,7 +134,7 @@ function editor(root, inputData, options) { function newItem(value) { let el = $('