Browse Source

feat: 显示src

main
npmrun 2 months ago
parent
commit
f2ce63b710
  1. 1
      examples/basic/index.html
  2. 6
      packages/core/src/index.ts

1
examples/basic/index.html

@ -11,6 +11,7 @@
<div id="app">
</div>
<form action="#" class="bubble-menu">
<input class="src-input" type="text">
<input class="alt-input" type="text">
<button>确认</button>
</form>

6
packages/core/src/index.ts

@ -61,10 +61,14 @@ class Inkeon {
//如果是图片或链接才显示菜单
if (editor.isActive("image")) {
const altInput = BubbleMenuElement.querySelector(
"input"
".alt-input"
) as HTMLInputElement;
const currentImage = editor.getAttributes("image");
altInput.value = currentImage.alt || "";
const srcInput = BubbleMenuElement.querySelector(
".src-input"
) as HTMLInputElement;
srcInput.value = currentImage.src || "";
}
return editor.isActive("image") || editor.isActive("link");
},

Loading…
Cancel
Save