-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(link): respect openOnClick: false configuration #6916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix(link): respect openOnClick: false configuration #6916
Conversation
Fixes ueberdosis#6865 where openOnClick: false was being ignored. The issue was that when openOnClick was false, no click handler plugin was added, allowing browser's default anchor behavior to take over. Now the click handler plugin is always added and controls behavior through preventDefault() and conditional window.open() based on the openOnClick setting.
|
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@tiptap/extension-character-count
@tiptap/extension-dropcursor
@tiptap/extension-focus
@tiptap/extension-gapcursor
@tiptap/extension-history
@tiptap/extension-list-item
@tiptap/extension-table-cell
@tiptap/extension-placeholder
@tiptap/extension-list-keymap
@tiptap/extension-table-row
@tiptap/extension-table-header
@tiptap/extension-task-item
@tiptap/extension-task-list
@tiptap/core
@tiptap/extension-blockquote
@tiptap/extension-bold
@tiptap/extension-bubble-menu
@tiptap/extension-bullet-list
@tiptap/extension-code-block
@tiptap/extension-code
@tiptap/extension-code-block-lowlight
@tiptap/extension-collaboration-caret
@tiptap/extension-collaboration
@tiptap/extension-details
@tiptap/extension-document
@tiptap/extension-color
@tiptap/extension-drag-handle
@tiptap/extension-drag-handle-react
@tiptap/extension-drag-handle-vue-2
@tiptap/extension-drag-handle-vue-3
@tiptap/extension-emoji
@tiptap/extension-file-handler
@tiptap/extension-floating-menu
@tiptap/extension-font-family
@tiptap/extension-hard-break
@tiptap/extension-highlight
@tiptap/extension-heading
@tiptap/extension-horizontal-rule
@tiptap/extension-image
@tiptap/extension-invisible-characters
@tiptap/extension-link
@tiptap/extension-italic
@tiptap/extension-list
@tiptap/extension-mathematics
@tiptap/extension-node-range
@tiptap/extension-mention
@tiptap/extension-ordered-list
@tiptap/extension-paragraph
@tiptap/extension-strike
@tiptap/extension-subscript
@tiptap/extension-superscript
@tiptap/extension-table
@tiptap/extension-text
@tiptap/extension-table-of-contents
@tiptap/extension-text-align
@tiptap/extension-typography
@tiptap/extension-text-style
@tiptap/extension-underline
@tiptap/extension-unique-id
@tiptap/extension-youtube
@tiptap/html
@tiptap/extensions
@tiptap/pm
@tiptap/react
@tiptap/starter-kit
@tiptap/suggestion
@tiptap/static-renderer
@tiptap/vue-2
@tiptap/vue-3
commit: |
Fixes #6865 where openOnClick: false was being ignored. The issue was that when openOnClick was false, no click handler plugin was added, allowing browser's default anchor behavior to take over.
Now the click handler plugin is always added and controls behavior through preventDefault() and conditional window.open() based on the openOnClick setting.
Changes Overview
Modified the Link extension to always register the click handler plugin regardless of the
openOnClick
setting. The plugin now internally handles theopenOnClick
logic by always preventing default browser behavior and conditionally opening links based on the configuration.Implementation Approach
openOnClick: false
, no click handler plugin was registered, so browser default anchor behavior prevailedclickHandler.ts
to accept and handleopenOnClick
parameter,link.ts
to always pass the setting to the pluginevent.preventDefault()
always called,window.open()
called conditionally based onopenOnClick
valueTesting Done
openOnClick: false
openOnClick
states work correctly:true
,false
,'whenNotEditable'
Verification Steps
npm run build
npm run dev
http://localhost:3000/src/Marks/Link/React/
openOnClick: false
configurationAdditional Notes
'whenNotEditable'
optionChecklist
Related Issues
Fixes #6865