From 48b8edc44a09cf511fce685b82c9e086501df816 Mon Sep 17 00:00:00 2001
From: yanmao <55792257+yanmao-cc@users.noreply.github.com>
Date: Tue, 7 Dec 2021 22:31:07 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20heading=20=E7=9A=84=20anchor=20=E6=8C=89?=
=?UTF-8?q?=E9=92=AE=E8=A2=AB=E5=88=A0=E9=99=A4=E5=90=8E=E6=97=A0=E6=B3=95?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=20tooltip=20=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages/engine/src/change/native-event.ts | 5 ++++-
plugins/heading/src/index.ts | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/packages/engine/src/change/native-event.ts b/packages/engine/src/change/native-event.ts
index 23874a75..d575afe9 100644
--- a/packages/engine/src/change/native-event.ts
+++ b/packages/engine/src/change/native-event.ts
@@ -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 = `${value}`;
} else if (html) {
diff --git a/plugins/heading/src/index.ts b/plugins/heading/src/index.ts
index 213c2535..175b5a88 100644
--- a/plugins/heading/src/index.ts
+++ b/plugins/heading/src/index.ts
@@ -62,6 +62,7 @@ export default class extends BlockPlugin {
const id = node.attributes('id');
if (id) {
node.find('.data-anchor-button').remove();
+ Tooltip.hide();
const button = $(
``,
);
@@ -173,6 +174,7 @@ export default class extends BlockPlugin {
if (block.length === 0) {
button.remove();
+ Tooltip.hide();
return;
}
const rootRect = root.get()?.getBoundingClientRect() || {
@@ -208,6 +210,7 @@ export default class extends BlockPlugin {
button.find('.data-icon-'.concat(block.name)).length === 0)
) {
button.remove();
+ Tooltip.hide();
}
if (block.length === 0 || card.closest(block, true)) {