File tree Expand file tree Collapse file tree
src/components/inline-tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,11 +172,21 @@ export default class LinkInlineTool implements InlineTool {
172172 * Unlink icon pressed
173173 */
174174 if ( parentAnchor ) {
175- this . selection . expandToTag ( parentAnchor ) ;
176- this . unlink ( ) ;
177- this . closeActions ( ) ;
178- this . checkState ( ) ;
179- this . toolbar . close ( ) ;
175+ /**
176+ * If input is not opened, treat click as explicit unlink action.
177+ * If input is opened (e.g., programmatic close when switching tools), avoid unlinking.
178+ */
179+ if ( ! this . inputOpened ) {
180+ this . selection . expandToTag ( parentAnchor ) ;
181+ this . unlink ( ) ;
182+ this . closeActions ( ) ;
183+ this . checkState ( ) ;
184+ this . toolbar . close ( ) ;
185+ } else {
186+ /** Only close actions without clearing saved selection to preserve user state */
187+ this . closeActions ( false ) ;
188+ this . checkState ( ) ;
189+ }
180190
181191 return ;
182192 }
You can’t perform that action at this time.
0 commit comments