handle editting html properly for custom html block

This commit is contained in:
David Botton 2022-07-21 02:55:30 -04:00
parent 616a623c48
commit 2028bb2d7a
2 changed files with 57 additions and 54 deletions

View file

@ -335,11 +335,11 @@
`((:name "html contents" `((:name "html contents"
:setup ,(lambda (control td1 td2) :setup ,(lambda (control td1 td2)
(declare (ignore td1)) (declare (ignore td1))
(let ((d1 (create-text-area td2 :value (attribute control "data-original-html")))) (let ((d1 (create-text-area td2 :value (escape-string (attribute control "data-original-html") :html t))))
(set-on-change d1 (lambda (obj) (set-on-change d1 (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(setf (attribute control "data-original-html") (escape-string (value d1) :html t)) (setf (attribute control "data-original-html") (value d1))
(setf (inner-html control) (escape-string (value d1) :html t))))) (setf (inner-html control) (value d1)))))
nil)))) nil))))
(defparameter *props-text* (defparameter *props-text*

View file

@ -701,10 +701,12 @@ not a temporary attached one when using select-control."
(labels ((add-siblings (control) (labels ((add-siblings (control)
(let (dct) (let (dct)
(loop (loop
(unless control (return))
(when (equal (html-id control) "undefined") (return)) (when (equal (html-id control) "undefined") (return))
(setf dct (attribute control "data-clog-name")) (setf dct (attribute control "data-clog-name"))
(unless (equal dct "undefined") (unless (equal dct "undefined")
(setf control (get-from-control-list app panel-id (html-id control))) (setf control (get-from-control-list app panel-id (html-id control)))
(when control
(let ((vname (attribute control "data-clog-name")) (let ((vname (attribute control "data-clog-name"))
(control-record (control-info (attribute control "data-clog-type")))) (control-record (control-info (attribute control "data-clog-type"))))
(unless (and (>= (length vname) 5) (unless (and (>= (length vname) 5)
@ -757,8 +759,9 @@ not a temporary attached one when using select-control."
vname vname
handler) handler)
creates))))) creates)))))
(add-siblings (first-child control))) (add-siblings (first-child control))))
(setf control (next-sibling control)))))) (when control
(setf control (next-sibling control)))))))
(add-siblings (first-child content))) (add-siblings (first-child content)))
(let ((result (format nil (let ((result (format nil
"\(in-package \"~A\"\) "\(in-package \"~A\"\)