mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 12:08:13 +08:00
amis-saas-8092 improve: 长文本表达式展示
Change-Id: I6ed6502eb10e9d5c9cf2080471a1297d4a7da012
This commit is contained in:
parent
29c315acff
commit
4d4658b5ef
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user