amis-saas-8092 improve: 长文本表达式展示

Change-Id: I6ed6502eb10e9d5c9cf2080471a1297d4a7da012
This commit is contained in:
huangying11 2022-11-17 15:52:09 +08:00
parent 29c315acff
commit 4d4658b5ef

View File

@ -186,9 +186,11 @@ export class FormulaPlugin {
expression = '',
className = 'cm-expression'
) {
const wrap = document.createElement('span');
wrap.className = className;
const text = document.createElement('span');
text.className = className;
text.innerText = '表达式';
text.className = `${className}-text`;
text.innerText = expression;
text.setAttribute('data-expression', expression);
text.onclick = () => {
const brace = this.getExpressionBrace(expression);
@ -209,11 +211,12 @@ export class FormulaPlugin {
const arrow = document.createElement('div');
arrow.classList.add('expression-popover-arrow');
popoverEl.appendChild(arrow);
text.appendChild(popoverEl);
wrap.appendChild(text);
wrap.appendChild(popoverEl);
this.editor.markText(from, to, {
atomic: true,
replacedWith: text
replacedWith: wrap
});
}