We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31a086d commit 6c9c243Copy full SHA for 6c9c243
src/index.ts
@@ -89,16 +89,19 @@ export default class InlineCode implements InlineTool {
89
let termWrapper = this.api.selection.findParentTag(this.tag, InlineCode.CSS) as HTMLElement;
90
91
/**
92
- * If start or end of selection is in the highlighted block
+ * If the start or end of the selection range is within a highlighted block
93
*/
94
if (termWrapper) {
95
this.unwrap(termWrapper);
96
} else {
97
- this.wrap(range);
+ const existingCodeTag = range.commonAncestorContainer.parentElement?.querySelector(this.tag);
98
+ if (!existingCodeTag) {
99
+ this.wrap(range);
100
+ }
101
}
102
103
- /**
104
+ /**
105
* Wrap selection with term-tag
106
*
107
* @param {Range} range - selected fragment
0 commit comments