cleanup and minor fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2025-02-11 17:26:42 +03:00
parent d6e975c86a
commit d04bf01748

View File

@ -338,14 +338,17 @@ var templates = {
// nested button... // nested button...
var nested_button var nested_button
header = header header = header
.trim()
.replace(/\[([^\]]*)\]/g, .replace(/\[([^\]]*)\]/g,
function(_, text){ function(_, text){
nested_button = true nested_button = true
return `<button>${ text.trim() }</button>` }) return `<button class="template-action">${
text.trim()
}</button>` })
// whole text is a button... // whole text is a button...
if(!nested_button){ if(!nested_button){
header = header =
`<button>${ `<button class="template-action">${
header.trim() == '' ? header.trim() == '' ?
this.__default_button_text__ this.__default_button_text__
: header.trim() : header.trim()
@ -368,6 +371,8 @@ var templates = {
while(e.tagName != 'BUTTON' while(e.tagName != 'BUTTON'
&& e.parentElement != null){ && e.parentElement != null){
e = e.parentElement } e = e.parentElement }
if(!e.classList.contains('template-action')){
return }
if(e.tagName == 'BUTTON'){ if(e.tagName == 'BUTTON'){
// get template data... // get template data...
var data = editor.data(elem) var data = editor.data(elem)