开源白板工具(SaaS),一体化白板,包含思维导图、流程图、自由画等。All in one open-source whiteboard tool with mind, flowchart, freehand and etc.
feat(link): improve link popup
pubuzhixing8eba06e2f9184
diff --git a/packages/drawnix/src/components/popup/link-popup/link-popup.scss b/packages/drawnix/src/components/popup/link-popup/link-popup.scssindex 92c7e18..a0a4b22 100644--- a/packages/drawnix/src/components/popup/link-popup/link-popup.scss+++ b/packages/drawnix/src/components/popup/link-popup/link-popup.scss@@ -16,12 +16,11 @@&__input {padding: 10px 0px;- width: 364px;+ width: 328px;border: none;border-radius: 4px;font-size: 14px;outline: none;- margin-right: 4px;}}}diff --git a/packages/drawnix/src/components/popup/link-popup/link-popup.tsx b/packages/drawnix/src/components/popup/link-popup/link-popup.tsxindex 7399a62..cbeaf02 100644--- a/packages/drawnix/src/components/popup/link-popup/link-popup.tsx+++ b/packages/drawnix/src/components/popup/link-popup/link-popup.tsx@@ -45,7 +45,21 @@ export const LinkPopup = () => {useEffect(() => {if (target) {- refs.setPositionReference(target);+ const rect = target.getBoundingClientRect();+ refs.setPositionReference({+ getBoundingClientRect() {+ return {+ x: rect.x,+ y: rect.y,+ width: rect.width,+ height: rect.height,+ top: rect.y,+ left: rect.x,+ right: rect.x + rect.width,+ bottom: rect.y + rect.height,+ };+ },+ });}}, [board.viewport, target]);@@ -128,20 +142,41 @@ export const LinkPopup = () => {><Stack.Row gap={1} align="center">{isEditing ? (- <input- type="text"- value={url}- onChange={(e) => {- setUrl(e.target.value);- }}- onKeyDown={(e) => {- if (e.key === 'Enter') {- saveUrlAndExitEditing();- }- }}- className="link-popup__input"- autoFocus- />+ <>+ <input+ type="text"+ value={url}+ onChange={(e) => {+ setUrl(e.target.value);+ }}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ saveUrlAndExitEditing();+ }+ }}+ className="link-popup__input"+ autoFocus+ />+ <ToolButton+ type="icon"+ visible={true}+ icon={TrashIcon}+ title={`Delete link`}+ aria-label={`Delete link`}+ onPointerDown={() => {+ const editor = linkState!.editor;+ const targetElement = linkState!.targetElement;+ const path = ReactEditor.findPath(editor, targetElement);+ Transforms.unwrapNodes(editor, {+ at: path,+ });+ setAppState({+ ...appState,+ linkState: null,+ });+ }}+ ></ToolButton>+ </>) : (<><a