fix: heading 的 anchor 按钮被删除后无法删除 tooltip 提示

This commit is contained in:
yanmao 2021-12-07 22:31:07 +08:00
parent 8eb946c5ef
commit 48b8edc44a
2 changed files with 7 additions and 1 deletions

View File

@ -473,7 +473,10 @@ class NativeEvent {
-1
) {
source = html;
} else if (text && /^https?:\/\/\S+$/.test(text)) {
} else if (
text &&
/^https?:\/\/\S+$/.test(text.toLowerCase().trim())
) {
const value = escape(text);
source = `<a href="${value}" target="_blank">${value}</a>`;
} else if (html) {

View File

@ -62,6 +62,7 @@ export default class extends BlockPlugin<Options> {
const id = node.attributes('id');
if (id) {
node.find('.data-anchor-button').remove();
Tooltip.hide();
const button = $(
`<a class="data-anchor-button"><span class="data-icon data-icon-${node.name}"></span></a>`,
);
@ -173,6 +174,7 @@ export default class extends BlockPlugin<Options> {
if (block.length === 0) {
button.remove();
Tooltip.hide();
return;
}
const rootRect = root.get<Element>()?.getBoundingClientRect() || {
@ -208,6 +210,7 @@ export default class extends BlockPlugin<Options> {
button.find('.data-icon-'.concat(block.name)).length === 0)
) {
button.remove();
Tooltip.hide();
}
if (block.length === 0 || card.closest(block, true)) {