'commit'
This commit is contained in:
@@ -237,9 +237,15 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
container.addEventListener('dblclick', (e) => {
|
||||
e.stopPropagation();
|
||||
const currentText = container.dataset.text || '';
|
||||
const textContent = prompt('请输入文字:', currentText);
|
||||
if (textContent !== null) {
|
||||
if (textContent.trim() === '') {
|
||||
// 使用layui layer.prompt替换原生prompt
|
||||
layer.prompt({
|
||||
title: '请输入文字',
|
||||
value: currentText,
|
||||
formType: 3, // 文本输入框类型
|
||||
area: ['300px', 'auto'] // 定义弹窗宽度
|
||||
}, function(value, index, elem){
|
||||
if (value !== null) {
|
||||
if (value.trim() === '') {
|
||||
container.querySelector('.arrow-text')?.remove();
|
||||
delete container.dataset.text;
|
||||
} else {
|
||||
@@ -249,11 +255,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
textElement.className = 'arrow-text';
|
||||
container.appendChild(textElement);
|
||||
}
|
||||
textElement.textContent = textContent;
|
||||
container.dataset.text = textContent;
|
||||
textElement.textContent = value;
|
||||
container.dataset.text = value;
|
||||
saveAllElements();
|
||||
}
|
||||
}
|
||||
layer.close(index); // 关闭弹窗
|
||||
});
|
||||
});
|
||||
|
||||
// 右键菜单支持
|
||||
|
Reference in New Issue
Block a user