@ni/nimble-components 20.17.3 → 20.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7291,7 +7291,7 @@ const i$="nimble-rich-text-mention-listbox",o$=Z`
7291
7291
  margin-block-end: 0;
7292
7292
  }
7293
7293
 
7294
- li > p {
7294
+ .ProseMirror li > p {
7295
7295
  margin-block: 0;
7296
7296
  }
7297
7297
 
@@ -7325,6 +7325,15 @@ const i$="nimble-rich-text-mention-listbox",o$=Z`
7325
7325
 
7326
7326
  ${""}
7327
7327
 
7328
+ ${""}
7329
+ .ProseMirror .nimble-mention-view-edit {
7330
+ color: ${Dc};
7331
+ }
7332
+
7333
+ :host([disabled]) .ProseMirror .nimble-mention-view-edit {
7334
+ color: ${Nc};
7335
+ }
7336
+
7328
7337
  .footer-section {
7329
7338
  display: flex;
7330
7339
  justify-content: space-between;
@@ -8245,7 +8254,7 @@ class kE{static parseMarkdownToDOM(e,t){try{kE.setup(t)
8245
8254
  const n=this.markdownParser.parse(e)
8246
8255
  return null===n?{fragment:document.createDocumentFragment(),mentionedHrefs:Array.from(kE.mentionedHrefs)}:{fragment:this.domSerializer.serializeFragment(n.content),mentionedHrefs:Array.from(kE.mentionedHrefs)}}finally{kE.cleanup()}}static initializeMarkdownParser(){const e=gE.tokenizer.configure("zero").enable(["emphasis","list","escape","autolink","newline"])
8247
8256
  return e.normalizeLinkText=e=>e,new fE(this.updatedSchema,e,gE.tokens)}static getCustomSchemaConfiguration(){return new yb({nodes:lE.spec.nodes,marks:{link:{attrs:{href:{},rel:{default:"noopener noreferrer"},class:{default:""}},inclusive:!1,excludes:"_",toDOM(e){const t=e.attrs.href,n=kE.mentionConfigs?.find((e=>e.isValidMentionHref(t))),i=n?.getDisplayName(t)
8248
- return n&&i?(kE.mentionedHrefs.add(t),[n.viewElement,{"mention-href":t,"mention-label":i,"disable-editing":!0}]):[Jd,{href:/^https?:\/\//i.test(t)?t:null,rel:e.attrs.rel,class:t}]}},em:lE.spec.marks.get("em"),strong:lE.spec.marks.get("strong")}})}static setup(e){kE.mentionConfigs=e,kE.mentionedHrefs.clear()}static cleanup(){kE.mentionConfigs=void 0,kE.mentionedHrefs.clear()}}xE=kE,kE.mentionedHrefs=new Set,kE.updatedSchema=xE.getCustomSchemaConfiguration(),kE.markdownParser=xE.initializeMarkdownParser(),kE.domSerializer=Tb.fromSchema(xE.updatedSchema)
8257
+ return n&&i?(kE.mentionedHrefs.add(t),[n.viewElement,{"mention-href":t,"mention-label":i}]):[Jd,{href:/^https?:\/\//i.test(t)?t:null,rel:e.attrs.rel,class:t}]}},em:lE.spec.marks.get("em"),strong:lE.spec.marks.get("strong")}})}static setup(e){kE.mentionConfigs=e,kE.mentionedHrefs.clear()}static cleanup(){kE.mentionConfigs=void 0,kE.mentionedHrefs.clear()}}xE=kE,kE.mentionedHrefs=new Set,kE.updatedSchema=xE.getCustomSchemaConfiguration(),kE.markdownParser=xE.initializeMarkdownParser(),kE.domSerializer=Tb.fromSchema(xE.updatedSchema)
8249
8258
  class CE{constructor(e){this.markdownSerializer=this.initializeMarkdownSerializerForTipTap(e)}serializeDOMToMarkdown(e){return this.markdownSerializer.serialize(e)}initializeMarkdownSerializerForTipTap(e){const t=function(e,t){const n=t.attrs.href
8250
8259
  e.write(`<${n}>`)},n={bulletList:bE.nodes.bullet_list,listItem:bE.nodes.list_item,orderedList:function(e,t){const n=t.attrs.start||1,i=String(n+t.childCount-1).length,o=e.repeat(" ",i+2)
8251
8260
  e.renderList(t,o,(t=>{const o=String(n+t)
@@ -8558,7 +8567,7 @@ const r=e.view.state.selection.$to.nodeAfter;(null===(i=null==r?void 0:r.text)||
8558
8567
  return!!n.parent.type.contentMatch.matchType(i)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes:()=>({id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}}}),parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){return["span",_C({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e})]},renderText({node:e}){return this.options.renderLabel({options:this.options,node:e})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command((({tr:e,state:t})=>{let n=!1
8559
8568
  const{selection:i}=t,{empty:o,anchor:r}=i
8560
8569
  return!!o&&(t.doc.nodesBetween(r-1,r,((t,i)=>{if(t.type.name===this.name)return n=!0,e.insertText(this.options.suggestion.char||"",i,i+t.nodeSize),!1})),n)}))}},addProseMirrorPlugins(){return[lO({editor:this.editor,...this.options.suggestion})]}}),hO=/^https?:\/\//i
8561
- function uO(e,t,n,i,o,r){const s=YA.extend({excludes:"_",inclusive:!1,parseHTML:()=>[{tag:Jd},{tag:"a"}],renderHTML:({HTMLAttributes:e})=>["a",e]}).configure({HTMLAttributes:{rel:"noopener noreferrer",target:null,class:""},autolink:!0,openOnClick:!1,linkOnPaste:!1,validate:e=>hO.test(e)}),a=i.map((n=>function(e,t,n,i){return dO.extend({name:e.name,parseHTML:()=>[{tag:e.viewElement}],addAttributes:()=>({href:{default:null,parseHTML:e=>e.getAttribute("mention-href"),renderHTML:e=>({"mention-href":e.href})},label:{default:null,parseHTML:e=>e.getAttribute("mention-label"),renderHTML:e=>({"mention-label":e.label})},disabled:{default:null,parseHTML:e=>e.getAttribute("disabled"),renderHTML:e=>({disabled:e.disabled})}}),renderHTML({node:t,HTMLAttributes:n}){return[e.viewElement,_C(this.options.HTMLAttributes,n,{"disable-editing":""}),this.options.renderLabel({options:this.options,node:t})]}}).configure({suggestion:{char:e.character,pluginKey:new Bw(e.key),allowSpaces:!0,render:()=>{let o=!1
8570
+ function uO(e,t,n,i,o,r){const s=YA.extend({excludes:"_",inclusive:!1,parseHTML:()=>[{tag:Jd},{tag:"a"}],renderHTML:({HTMLAttributes:e})=>["a",e]}).configure({HTMLAttributes:{rel:"noopener noreferrer",target:null,class:""},autolink:!0,openOnClick:!1,linkOnPaste:!1,validate:e=>hO.test(e)}),a=i.map((n=>function(e,t,n,i){return dO.extend({name:e.name,parseHTML:()=>[{tag:e.viewElement}],addAttributes:()=>({href:{default:null,parseHTML:e=>e.getAttribute("mention-href"),renderHTML:e=>({"mention-href":e.href})},label:{default:null,parseHTML:e=>e.getAttribute("mention-label"),renderHTML:e=>({"mention-label":e.label})},disabled:{default:null,parseHTML:e=>e.getAttribute("disabled"),renderHTML:e=>({disabled:e.disabled})}}),renderHTML({node:t,HTMLAttributes:n}){return[e.viewElement,_C(this.options.HTMLAttributes,n),this.options.renderLabel({options:this.options,node:t})]}}).configure({suggestion:{char:e.character,decorationClass:"nimble-mention-view-edit",pluginKey:new Bw(e.key),allowSpaces:!0,render:()=>{let o=!1
8562
8571
  return{onStart:r=>{null!==r.decorationNode&&(o=!0,e.mentionUpdateEmitter(r.query),t(r.text.slice(0,1)),n(r.command),i?.show({filter:r.query,anchorNode:r.decorationNode}))},onUpdate:t=>{o&&(e.mentionUpdateEmitter(t.query),n(t.command),i?.show({filter:t.query,anchorNode:t.decorationNode}))},onKeyDown:e=>!!o&&(e.event.key===ha&&(o=!1),i?.keydownHandler(e.event)??!1),onExit:()=>{t(""),n(void 0),i?.close()}}}}})}(n,e,t,o))),l=new OS({element:n,enableInputRules:[LE,iO],enablePasteRules:!1,editorProps:{transformPasted:function(e){const t=pO(l,e.content)
8563
8572
  return new Lv(t,e.openStart,e.openEnd)}},extensions:[VE,oO,sO,LE,iO,QA,DE,dI,rI,rO.configure({placeholder:r,showOnlyWhenEditable:!1}),zS,s,...a]})
8564
8573
  return l}function pO(e,t){const n=[]