File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @editorjs/inline-code" ,
3- "version" : " 1.5.1 " ,
3+ "version" : " 1.5.2 " ,
44 "keywords" : [
55 " codex editor" ,
66 " inline" ,
Original file line number Diff line number Diff line change @@ -89,16 +89,19 @@ export default class InlineCode implements InlineTool {
8989 let termWrapper = this . api . selection . findParentTag ( this . tag , InlineCode . CSS ) as HTMLElement ;
9090
9191 /**
92- * If start or end of selection is in the highlighted block
92+ * If the start or end of the selection range is within a highlighted block
9393 */
9494 if ( termWrapper ) {
9595 this . unwrap ( termWrapper ) ;
9696 } else {
97- this . wrap ( range ) ;
97+ const existingCodeTag = range . commonAncestorContainer . parentElement ?. querySelector ( this . tag ) ;
98+ if ( ! existingCodeTag ) {
99+ this . wrap ( range ) ;
100+ }
98101 }
99102 }
100103
101- /**
104+ /**
102105 * Wrap selection with term-tag
103106 *
104107 * @param {Range } range - selected fragment
You can’t perform that action at this time.
0 commit comments