@@ -6,8 +6,9 @@ import { checkIcon, addIcon } from '@jupyterlab/ui-components';
66import React from 'react' ;
77
88interface ICodeSnippetEditorTagProps {
9- selectedTags : string [ ] ;
10- tags : string [ ] ;
9+ selectedTags : string [ ] ; // selected snippet tags only
10+ snippetTags : string [ ] ; // snippet tags only
11+ langTags : string [ ] ;
1112 handleChange : ( selectedTags : string [ ] , allTags : string [ ] ) => void ;
1213}
1314
@@ -44,7 +45,7 @@ export class CodeSnippetEditorTags extends React.Component<
4445 componentDidMount ( ) : void {
4546 this . setState ( {
4647 selectedTags : this . props . selectedTags ? this . props . selectedTags : [ ] ,
47- tags : this . props . tags ? this . props . tags : [ ] ,
48+ tags : this . props . snippetTags ? this . props . snippetTags : [ ] ,
4849 plusIconShouldHide : false ,
4950 addingNewTag : false ,
5051 } ) ;
@@ -54,7 +55,7 @@ export class CodeSnippetEditorTags extends React.Component<
5455 if ( prevProps !== this . props ) {
5556 this . setState ( {
5657 selectedTags : this . props . selectedTags ? this . props . selectedTags : [ ] ,
57- tags : this . props . tags ? this . props . tags : [ ] ,
58+ tags : this . props . snippetTags ? this . props . snippetTags : [ ] ,
5859 } ) ;
5960 }
6061 }
@@ -117,6 +118,13 @@ export class CodeSnippetEditorTags extends React.Component<
117118 return ;
118119 }
119120
121+ if ( this . props . langTags . includes ( inputElement . value ) ) {
122+ alert (
123+ 'This tag already exists in language tags!\nIf you want to create this tag, lowercase the first letter.'
124+ ) ;
125+ return ;
126+ }
127+
120128 const newTag = inputElement . value ;
121129
122130 // update state all tag and selected tag
0 commit comments