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 1
1
{
2
2
"name" : " @editorjs/inline-code" ,
3
- "version" : " 1.5.1 " ,
3
+ "version" : " 1.5.2 " ,
4
4
"keywords" : [
5
5
" codex editor" ,
6
6
" inline" ,
Original file line number Diff line number Diff line change @@ -89,16 +89,19 @@ export default class InlineCode implements InlineTool {
89
89
let termWrapper = this . api . selection . findParentTag ( this . tag , InlineCode . CSS ) as HTMLElement ;
90
90
91
91
/**
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
93
93
*/
94
94
if ( termWrapper ) {
95
95
this . unwrap ( termWrapper ) ;
96
96
} else {
97
- this . wrap ( range ) ;
97
+ const existingCodeTag = range . commonAncestorContainer . parentElement ?. querySelector ( this . tag ) ;
98
+ if ( ! existingCodeTag ) {
99
+ this . wrap ( range ) ;
100
+ }
98
101
}
99
102
}
100
103
101
- /**
104
+ /**
102
105
* Wrap selection with term-tag
103
106
*
104
107
* @param {Range } range - selected fragment
You can’t perform that action at this time.
0 commit comments