869869 typeof tagData . value === 'string' &&
870870 decodeTagData !== tagData . value ;
871871 let tagLabel = tagData . value ;
872+ let isCustomHTML = false ;
872873 if ( isEncoded ) {
873874 decodeTagData = JSON . parse ( decodeTagData ) ;
874875 decodeTagData = decodeTagData [ 0 ] || { } ;
875876 tagLabel = decodeTagData . tag . replaceAll ( '_' , ' ' ) ;
877+ isCustomHTML = 'custom_html' === decodeTagData . id ;
876878 tagData [ 'data-actions' ] = tagData . value ;
877879 tagData [ 'data-field_id' ] = 'fz-content-action-tags' ;
878880 }
881+ if ( isCustomHTML ) {
882+ tagLabel = escapeText ( tagLabel ) ;
883+ return `
884+ <tag spellcheck="false" class='tagify__tag'>
885+ <span id="editable" class="feedzy-custom-tag tagify__tag-text" contenteditable='true'>${ tagLabel } </span>
886+ </tag>` ;
887+ }
888+
879889 return `
880890 <tag title='${ tagLabel } ' contenteditable='false' spellcheck="false" class='tagify__tag ${ isEncoded ? 'fz-content-action' : '' } '>
881891 <x title='remove tag' class='tagify__tag__removeBtn'></x>
10501060 url . searchParams . delete ( 'imported' ) ;
10511061 history . replaceState ( history . state , '' , url . href ) ;
10521062 }
1063+
1064+ const tagify = mixContent . focus ( ) . data ( 'tagify' ) ;
1065+
1066+ $ ( document ) . on ( 'input' , '.feedzy-post-content span' , function ( ) {
1067+ const tagElms = $ ( this ) . find ( 'tag' ) ;
1068+ tagElms . each ( ( i , ele ) => {
1069+ if ( $ ( ele ) . find ( '.feedzy-custom-tag' ) . length ) {
1070+ const newValue = ele . innerText ;
1071+ const data = tagify . getSetTagData ( ele ) ;
1072+
1073+ let decodeTagData = decodeURIComponent ( data . value ) ;
1074+ decodeTagData = JSON . parse ( decodeTagData ) ;
1075+ decodeTagData = decodeTagData [ 0 ] || { } ;
1076+ decodeTagData . tag = newValue ;
1077+
1078+ let encodeTagData = [ decodeTagData ] ;
1079+ encodeTagData = JSON . stringify ( encodeTagData , null , 0 )
1080+ data . value = encodeURIComponent ( encodeTagData ) ;
1081+
1082+ tagify . updateValueByDOMTags ( ) ;
1083+ }
1084+ } ) ;
1085+ } ) ;
10531086 }
10541087
10551088 function initSummary ( ) {
@@ -1539,3 +1572,16 @@ function initNewPostActions() {
15391572 postTitle . select ( ) ;
15401573 }
15411574}
1575+
1576+ /**
1577+ * Escape the text.
1578+ */
1579+ function escapeText ( label ) {
1580+ return label
1581+ . trim ( )
1582+ . replace ( / & / g, '&' )
1583+ . replace ( / < / g, '<' )
1584+ . replace ( / > / g, '>' )
1585+ . replace ( / " / g, '"' )
1586+ . replace ( / ' / g, ''' )
1587+ }
0 commit comments