From e664524caa18b46e108e245040b05fdf5da816e4 Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 1 Mar 2023 11:33:54 +0800 Subject: [PATCH] store caption in data-caption --- Roo/htmleditor/BlockFigure.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Roo/htmleditor/BlockFigure.js b/Roo/htmleditor/BlockFigure.js index bf0dca8db7..2d8a6e9dc8 100644 --- a/Roo/htmleditor/BlockFigure.js +++ b/Roo/htmleditor/BlockFigure.js @@ -322,7 +322,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { var ret = { tag: 'figure', 'data-block' : 'Figure', - 'data-width' : this.width, + 'data-width' : this.width, + 'data-caption' : this.caption, contenteditable : 'false', style : { @@ -395,6 +396,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.image_src = this.getVal(node, 'img', 'src'); this.align = this.getVal(node, 'figure', 'align'); + + /// not really used - as hidden captions do not store the content here.. var figcaption = this.getVal(node, 'figcaption', false); if (figcaption !== '') { this.caption = this.getVal(figcaption, 'i', 'html'); @@ -402,6 +405,10 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.caption_display = this.getVal(node, 'figcaption', 'data-display'); + var dc = this.getVal(node, 'figcaption', 'data-caption'); + if (dc && dc.length) { + this.caption = dc; + } //this.text_align = this.getVal(node, 'figcaption', 'style','text-align'); this.width = this.getVal(node, true, 'data-width'); //this.margin = this.getVal(node, 'figure', 'style', 'margin'); -- 2.39.2