@kubex/zinc 1.1.162 → 1.1.163
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.
|
@@ -53826,7 +53826,7 @@
|
|
|
53826
53826
|
"package": {
|
|
53827
53827
|
"name": "@kubex/zinc",
|
|
53828
53828
|
"description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
|
|
53829
|
-
"version": "1.1.
|
|
53829
|
+
"version": "1.1.163",
|
|
53830
53830
|
"author": "",
|
|
53831
53831
|
"license": "MIT"
|
|
53832
53832
|
}
|
package/dist/web-types.json
CHANGED
package/dist/zn.min.js
CHANGED
|
@@ -4450,7 +4450,8 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4450
4450
|
</div>`}return u`
|
|
4451
4451
|
<div class="remarkd-editor__conditional-body remarkd-rendered">
|
|
4452
4452
|
${o.map(t=>{if(t.kind==="nested")return wg(t.label,t.parts);let r=t.lines.join(`
|
|
4453
|
-
`).trim();return r?u
|
|
4453
|
+
`).trim();return r?u`
|
|
4454
|
+
<div class="remarkd-editor__rendered--parsed">${Pt(xg(r))}</div>`:""})}
|
|
4454
4455
|
</div>`}function wg(o,i){return u`
|
|
4455
4456
|
<div part="conditional" class="remarkd-editor__conditional">
|
|
4456
4457
|
<span class="remarkd-editor__conditional-label">
|
|
@@ -4490,7 +4491,8 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4490
4491
|
<span>Alignment</span>
|
|
4491
4492
|
<zn-button-group>
|
|
4492
4493
|
${r.map(n=>u`
|
|
4493
|
-
<zn-button
|
|
4494
|
+
<zn-button icon-button="small"
|
|
4495
|
+
icon=${n.icon}
|
|
4494
4496
|
?plain=${t.align!==n.value}
|
|
4495
4497
|
tooltip=${n.label}
|
|
4496
4498
|
@click=${()=>this.updateImageEdit({align:n.value})}></zn-button>`)}
|
|
@@ -4513,12 +4515,15 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4513
4515
|
</label>
|
|
4514
4516
|
</div>
|
|
4515
4517
|
<div class="remarkd-editor__image-buttons">
|
|
4516
|
-
<zn-button
|
|
4517
|
-
<zn-button
|
|
4518
|
+
<zn-button color="primary" size="small" @click=${this.saveImageEdit}>Save</zn-button>
|
|
4519
|
+
<zn-button color="secondary" size="small" @click=${this.closeImageEdit}>Cancel</zn-button>
|
|
4518
4520
|
<span class="remarkd-editor__image-buttons-spacer"></span>
|
|
4519
|
-
<zn-button
|
|
4520
|
-
|
|
4521
|
-
|
|
4521
|
+
<zn-button icon-button="small"
|
|
4522
|
+
plain
|
|
4523
|
+
icon="code@lu"
|
|
4524
|
+
tooltip="Edit source"
|
|
4525
|
+
@click=${this.editImageSource}></zn-button>
|
|
4526
|
+
<zn-button icon-button="small" plain icon="trash-2@lu" color="error"
|
|
4522
4527
|
tooltip="Delete image" @click=${this.deleteImageBlock}></zn-button>
|
|
4523
4528
|
</div>
|
|
4524
4529
|
</div>`}renderIncludeChip(t){let r=this.includeOptions?.find(l=>l.id===t.target),n=/[/.]/.test(t.target),a=!this.includeUrl||this.includeOptions===null,s=!r&&!a&&!n;return u`
|
|
@@ -4565,12 +4570,19 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4565
4570
|
@pointerdown=${this.handleHandlePointerDown}>
|
|
4566
4571
|
<zn-icon src="grip-vertical@lu" size="16"></zn-icon>
|
|
4567
4572
|
</span>
|
|
4568
|
-
<zn-button
|
|
4573
|
+
<zn-button icon-button="small"
|
|
4574
|
+
plain
|
|
4575
|
+
icon="plus@lu"
|
|
4576
|
+
icon-size="16"
|
|
4569
4577
|
tooltip="Add block below"
|
|
4570
4578
|
@click=${()=>this.insertDraftBlock(r+1)}></zn-button>
|
|
4571
4579
|
</div>
|
|
4572
4580
|
<zn-button class="remarkd-editor__delete"
|
|
4573
|
-
|
|
4581
|
+
icon-button="small"
|
|
4582
|
+
plain
|
|
4583
|
+
icon="x@lu"
|
|
4584
|
+
icon-size="16"
|
|
4585
|
+
color="error"
|
|
4574
4586
|
tooltip="Delete block"
|
|
4575
4587
|
@click=${()=>this.deleteBlock(r)}></zn-button>`}
|
|
4576
4588
|
<div part="rendered"
|
|
@@ -4578,7 +4590,10 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4578
4590
|
@click=${l=>this.handleRenderedClick(l,r)}>${n?this.renderIncludeChip(n):a||(s?this.renderMetaChips(s):Pt(xg(t)))}
|
|
4579
4591
|
</div>
|
|
4580
4592
|
</div>`}isActionDisabled(t){return(!!t.inline||t.opens==="link")&&this.editingIndex===null}actionAvailable(t){return t.opens==="image"?!!this.attachmentUrl:t.opens==="include"?!!this.includeUrl:t.opens==="link"?!!this.linkUrl:!0}slashItemAvailable(t){return t.action==="image"?!!this.attachmentUrl:t.action==="include"?!!this.includeUrl:t.action==="link"?!!this.linkUrl:!0}activateAction(t){t.opens==="link"?this.pickLink():t.inline?this.applyInline(t.inline):this.handleToolbarInsert(t)}renderAction(t){return u`
|
|
4581
|
-
<zn-button
|
|
4593
|
+
<zn-button icon-button="small"
|
|
4594
|
+
plain
|
|
4595
|
+
icon=${t.icon}
|
|
4596
|
+
icon-size="18"
|
|
4582
4597
|
tooltip=${t.label}
|
|
4583
4598
|
?disabled=${this.isActionDisabled(t)}
|
|
4584
4599
|
@mousedown=${r=>r.preventDefault()}
|
|
@@ -4604,16 +4619,23 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4604
4619
|
<zn-dropdown class="remarkd-editor__toolbar-more" placement="bottom-end"
|
|
4605
4620
|
@zn-show=${s=>{s.target===s.currentTarget&&(this.suppressBlurCommit=!0)}}
|
|
4606
4621
|
@zn-hide=${s=>{s.target===s.currentTarget&&(this.linkPickerOpen||(this.suppressBlurCommit=!1))}}>
|
|
4607
|
-
<zn-button slot="trigger"
|
|
4608
|
-
icon-
|
|
4622
|
+
<zn-button slot="trigger"
|
|
4623
|
+
icon-button="small"
|
|
4624
|
+
plain
|
|
4625
|
+
icon="ellipsis@lu"
|
|
4626
|
+
icon-size="18"
|
|
4627
|
+
tooltip="More"
|
|
4609
4628
|
@mousedown=${s=>s.preventDefault()}></zn-button>
|
|
4610
4629
|
<zn-menu>
|
|
4611
4630
|
${a.flatMap(s=>s.actions).map(s=>this.renderMenuAction(s))}
|
|
4612
4631
|
</zn-menu>
|
|
4613
4632
|
</zn-dropdown>`:""}`})()}
|
|
4614
4633
|
${this.allowRaw?u`
|
|
4615
|
-
<zn-button part="raw-toggle"
|
|
4616
|
-
|
|
4634
|
+
<zn-button part="raw-toggle"
|
|
4635
|
+
class="remarkd-editor__raw-toggle"
|
|
4636
|
+
icon-button="small"
|
|
4637
|
+
icon="code-xml@lu"
|
|
4638
|
+
icon-size="18"
|
|
4617
4639
|
?plain=${!this.rawMode}
|
|
4618
4640
|
tooltip=${this.rawMode?"Show blocks":"Show raw source"}
|
|
4619
4641
|
@click=${this.toggleRawMode}></zn-button>`:""}
|
|
@@ -4649,16 +4671,22 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4649
4671
|
placeholder="Find an Include"
|
|
4650
4672
|
.value=${this.includeQuery}
|
|
4651
4673
|
@input=${n=>{this.includeQuery=n.target.value}}>
|
|
4652
|
-
<zn-button
|
|
4653
|
-
|
|
4674
|
+
<zn-button icon-button="small"
|
|
4675
|
+
plain
|
|
4676
|
+
icon="x@lu"
|
|
4677
|
+
tooltip="Cancel"
|
|
4678
|
+
@click=${this.closeIncludePicker}></zn-button>
|
|
4654
4679
|
</div>
|
|
4655
|
-
${this.includeOptions===null?u
|
|
4680
|
+
${this.includeOptions===null?u`
|
|
4681
|
+
<div class="remarkd-editor__include-picker-empty">${this.includeLoadFailed?"Could not load Includes":"Loading\u2026"}
|
|
4682
|
+
</div>`:r.length?r.map(n=>u`
|
|
4656
4683
|
<button type="button" class="remarkd-editor__include-option"
|
|
4657
4684
|
?disabled=${!n.languages}
|
|
4658
4685
|
@click=${()=>this.insertInclude(n)}>
|
|
4659
4686
|
<span class="remarkd-editor__include-option-title">${n.title}</span>
|
|
4660
4687
|
<span class="remarkd-editor__include-option-meta">${n.scope??""}${n.languages?` \xB7 ${n.languages}`:" \xB7 No content"}</span>
|
|
4661
|
-
</button>`):u
|
|
4688
|
+
</button>`):u`
|
|
4689
|
+
<div class="remarkd-editor__include-picker-empty">No Includes found</div>`}
|
|
4662
4690
|
</div>`}renderLinkPicker(){let t={document:"Article",category:"Category",page:"Page"};return u`
|
|
4663
4691
|
<div part="link-picker" class="remarkd-editor__link-picker">
|
|
4664
4692
|
<div class="remarkd-editor__link-picker-head">
|
|
@@ -4666,15 +4694,21 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4666
4694
|
placeholder="Find an article"
|
|
4667
4695
|
.value=${this.linkQuery}
|
|
4668
4696
|
@input=${r=>{this.linkQuery=r.target.value,this.searchLinks(this.linkQuery)}}>
|
|
4669
|
-
<zn-button
|
|
4670
|
-
|
|
4697
|
+
<zn-button icon-button="small"
|
|
4698
|
+
plain
|
|
4699
|
+
icon="x@lu"
|
|
4700
|
+
tooltip="Cancel"
|
|
4701
|
+
@click=${this.closeLinkPicker}></zn-button>
|
|
4671
4702
|
</div>
|
|
4672
|
-
${this.linkResults===null?u
|
|
4703
|
+
${this.linkResults===null?u`
|
|
4704
|
+
<div class="remarkd-editor__link-picker-empty">${this.linkSearchFailed?"Could not search for articles":"Searching\u2026"}
|
|
4705
|
+
</div>`:this.linkResults.length?this.linkResults.map(r=>u`
|
|
4673
4706
|
<button type="button" class="remarkd-editor__link-option"
|
|
4674
4707
|
@click=${()=>this.insertLink(r)}>
|
|
4675
4708
|
<span class="remarkd-editor__link-option-title">${r.title}</span>
|
|
4676
4709
|
<span class="remarkd-editor__link-option-meta">${[t[r.kind]??r.kind,r.context,r.status==="published"?"":r.status].filter(Boolean).join(" \xB7 ")}</span>
|
|
4677
|
-
</button>`):u
|
|
4710
|
+
</button>`):u`
|
|
4711
|
+
<div class="remarkd-editor__link-picker-empty">No articles found</div>`}
|
|
4678
4712
|
</div>`}insertLink(t){let r=this.shadowRoot?.querySelector(".remarkd-editor__input"),n=this.linkSelection;if(this.linkPickerOpen=!1,this.linkSelection=null,this.suppressBlurCommit=!1,!r||!n)return;let[a,s]=n,l=r.value.slice(a,s).trim(),d=bq(t.ref,l||t.title),h=r.value.slice(0,a)+d+r.value.slice(s);this.editingDraft=h,r.value=h,r.setSelectionRange(a+d.length,a+d.length),this.editShell=this.computeEditShell(h),this.autosize(r),r.focus({preventScroll:!0}),this.emit("zn-input")}renderImagePicker(){return u`
|
|
4679
4713
|
<div class="remarkd-editor__image-picker">
|
|
4680
4714
|
<zn-file class="remarkd-editor__image-file"
|
|
@@ -4682,7 +4716,9 @@ ${this.parseList(r)}`}let a=t.ordered?"ol":"ul";return`<${a}>${n.join(`</li>
|
|
|
4682
4716
|
accept="image/*"
|
|
4683
4717
|
droparea
|
|
4684
4718
|
@zn-change=${this.handleImagePicked}></zn-file>
|
|
4685
|
-
<zn-button
|
|
4719
|
+
<zn-button icon-button="small"
|
|
4720
|
+
plain
|
|
4721
|
+
icon="x@lu"
|
|
4686
4722
|
tooltip="Cancel"
|
|
4687
4723
|
@click=${this.closeImagePicker}></zn-button>
|
|
4688
4724
|
</div>`}};me.styles=z(Y2),me.dependencies={"zn-dropdown":ur,"zn-menu":on,"zn-menu-item":xi,"zn-slash-menu":Ea},c([B(".remarkd-editor__validation")],me.prototype,"validationInput",2),c([B("zn-slash-menu")],me.prototype,"slashMenuElement",2),c([I()],me.prototype,"blocks",2),c([I()],me.prototype,"editingIndex",2),c([p({attribute:"slash-recent-key"})],me.prototype,"slashRecentKey",2),c([I()],me.prototype,"hasSlashMenu",2),c([I()],me.prototype,"imagePickerIndex",2),c([I()],me.prototype,"imageEdit",2),c([I()],me.prototype,"dropIndicator",2),c([I()],me.prototype,"dragIndex",2),c([I()],me.prototype,"editShell",2),c([I()],me.prototype,"rawMode",2),c([I()],me.prototype,"includeOptions",2),c([I()],me.prototype,"includeLoadFailed",2),c([I()],me.prototype,"includePickerIndex",2),c([I()],me.prototype,"includeQuery",2),c([I()],me.prototype,"linkPickerOpen",2),c([I()],me.prototype,"linkQuery",2),c([I()],me.prototype,"linkResults",2),c([I()],me.prototype,"linkSearchFailed",2),c([p()],me.prototype,"name",2),c([p()],me.prototype,"value",2),c([Te()],me.prototype,"defaultValue",2),c([p()],me.prototype,"placeholder",2),c([p({attribute:"attachment-url"})],me.prototype,"attachmentUrl",2),c([p({attribute:"include-url"})],me.prototype,"includeUrl",2),c([p({attribute:"link-url"})],me.prototype,"linkUrl",2),c([p({type:Boolean,attribute:"allow-raw",reflect:!0})],me.prototype,"allowRaw",2),c([p({type:Boolean,reflect:!0})],me.prototype,"required",2),c([p({type:Boolean,reflect:!0})],me.prototype,"readonly",2),c([p({type:Boolean,reflect:!0})],me.prototype,"disabled",2),c([K("value")],me.prototype,"handleValueChange",1),c([K("includeUrl",{waitUntilFirstUpdate:!0})],me.prototype,"handleIncludeUrlChange",1),c([K("linkUrl",{waitUntilFirstUpdate:!0})],me.prototype,"handleLinkUrlChange",1);var qh=me;me.define("zn-remarkd-editor");var ok=k`:host{display:block}.translations{padding:var(--zn-spacing-small) var(--zn-spacing-medium)}.translations__language{margin-bottom:var(--zn-spacing-medium)}.translations__body{display:block}.translations--flush,.translations--grouped{padding:0}`;var Me=class extends S{constructor(){super(...arguments);this.formControlController=new re(this);this.hasSlotController=new Y(this,"label","help-text");this.name="";this.value='{"en":""}';this.label="";this.helpText="";this.disabled=!1;this.required=!1;this.flush=!1;this.inputType="text";this.allowRaw=!1;this.attachmentUrl="";this.includeUrl="";this.linkUrl="";this.inlineEdit=!1;this.slashItems=[];this.slashPreset="";this.slashTrigger="/";this.slashHeading="Insert";this.slashHideKeys=!1;this.slashRecentKey="";this.grouped=!1;this.languages={en:"EN"};this.values={};this.defaultValue='{"en":""}';this._activeLanguage="en";this.handleLanguageSelect=t=>{t.stopPropagation();let r=t.target.value;typeof r=="string"&&r&&r!==this._activeLanguage&&this.switchLanguage(r)};this.handleLanguageInput=t=>{t.stopPropagation()};this.switchLanguage=t=>{this._activeLanguage=t,this.requestUpdate()};this.handleValueUpdate=t=>{let r=t.target;if(this._activeLanguage){let n=r.value;n!==this.values[this._activeLanguage]&&(this.values={...this.values,[this._activeLanguage]:n},this.updateValue())}};this.handleKeyDown=t=>{if(t.key==="Enter"){if(t.target instanceof lp||t.target instanceof Jo||t.target instanceof qh)return;!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)&&!t.defaultPrevented&&!t.isComposing&&this.formControlController.submit()}};this.handleSubmit=()=>{this.formControlController.submit()}}get validity(){return et}get validationMessage(){return""}checkValidity(){return!0}getForm(){return this.formControlController.getForm()}reportValidity(){return!0}setCustomValidity(){}setActiveLanguage(t){this._activeLanguage=t,this.requestUpdate()}getActiveLanguage(){return this._activeLanguage}addLanguageKey(t){let r=this.pendingValues();Object.prototype.hasOwnProperty.call(r,t)||(this.values={...r,[t]:""},this.updateValue())}getValueLanguages(){return Object.keys(this.pendingValues())}hasTranslation(t){return(this.pendingValues()[t]??"").trim()!==""}languageState(t){return this.hasTranslation(t)?{type:"success",label:"Translated"}:{type:"error",label:t==="en"?"Empty":"English"}}languageLabel(t){return this.languages[t]??t.toUpperCase()}pendingValues(){if(Object.keys(this.values).length>0)return this.values;try{return JSON.parse(this.value||"{}")}catch{return this.values}}firstUpdated(){this.hasAttribute("value")||(this.defaultValue=this.value),this.formControlController.updateValidity()}willUpdate(t){let r=t.has("value"),n=t.has("values");if(r&&n){let a=this.value==='{"en":""}',s=Object.keys(this.values).length===0;a&&!s?r=!1:!a&&s?n=!1:this.hasAttribute("values")&&!this.hasAttribute("value")?r=!1:this.hasAttribute("value")&&!this.hasAttribute("values")&&(n=!1)}if(r)try{let a=JSON.parse(this.value||"{}");JSON.stringify(a)!==JSON.stringify(this.values)&&(this.values=a)}catch{}if(n&&(this.value=JSON.stringify(this.values),!this.grouped)){let a=Object.prototype.hasOwnProperty.call(this.values,this._activeLanguage)||Object.prototype.hasOwnProperty.call(this.languages,this._activeLanguage);if(!this._activeLanguage||!a&&this._activeLanguage!=="en"){let s=Object.keys(this.values);s.length>0?this._activeLanguage=s[0]:this._activeLanguage="en"}}}updateValue(){this.value=JSON.stringify(this.values),this.emit("zn-change"),this.emit("zn-input")}renderField(t,r,n){let a=n?"rtl":"ltr";return this.inlineEdit?u`
|
package/package.json
CHANGED
|
@@ -279,7 +279,8 @@ function renderConditionalParts(parts: ConditionalPart[]): TemplateResult {
|
|
|
279
279
|
${parts.map(part => {
|
|
280
280
|
if (part.kind === 'nested') return renderConditionalWrapper(part.label, part.parts);
|
|
281
281
|
const text = part.lines.join('\n').trim();
|
|
282
|
-
return text ? html
|
|
282
|
+
return text ? html`
|
|
283
|
+
<div class="remarkd-editor__rendered--parsed">${unsafeHTML(safeParse(text))}</div>` : '';
|
|
283
284
|
})}
|
|
284
285
|
</div>`;
|
|
285
286
|
}
|
|
@@ -1232,7 +1233,7 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1232
1233
|
fetch(url, {headers: {Accept: 'application/json'}})
|
|
1233
1234
|
.then(res => {
|
|
1234
1235
|
if (!res.ok) throw new Error(`link search failed: ${res.status}`);
|
|
1235
|
-
return res.json() as Promise<{items?: LinkOption[]}>;
|
|
1236
|
+
return res.json() as Promise<{ items?: LinkOption[] }>;
|
|
1236
1237
|
})
|
|
1237
1238
|
.then(data => {
|
|
1238
1239
|
if (token !== this.linkSearchToken) return;
|
|
@@ -1329,7 +1330,7 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1329
1330
|
this.includeRequest = fetch(this.includeUrl, {headers: {Accept: 'application/json'}})
|
|
1330
1331
|
.then(res => {
|
|
1331
1332
|
if (!res.ok) throw new Error(`include list request failed: ${res.status}`);
|
|
1332
|
-
return res.json() as Promise<{items?: IncludeOption[]}>;
|
|
1333
|
+
return res.json() as Promise<{ items?: IncludeOption[] }>;
|
|
1333
1334
|
})
|
|
1334
1335
|
.then(data => {
|
|
1335
1336
|
const items = data.items ?? [];
|
|
@@ -1367,7 +1368,7 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1367
1368
|
fetch(url, {headers: {Accept: 'application/json'}})
|
|
1368
1369
|
.then(res => {
|
|
1369
1370
|
if (!res.ok) throw new Error(`link resolve failed: ${res.status}`);
|
|
1370
|
-
return res.json() as Promise<{items?: LinkOption[]}>;
|
|
1371
|
+
return res.json() as Promise<{ items?: LinkOption[] }>;
|
|
1371
1372
|
})
|
|
1372
1373
|
.then(data => {
|
|
1373
1374
|
const known = new Map((data.items ?? []).map(item => [item.ref, item]));
|
|
@@ -1529,7 +1530,7 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1529
1530
|
private renderImageControls() {
|
|
1530
1531
|
const data = this.imageEdit;
|
|
1531
1532
|
if (!data) return '';
|
|
1532
|
-
const aligns: {value: ImageBlockData['align']; icon: string; label: string}[] = [
|
|
1533
|
+
const aligns: { value: ImageBlockData['align']; icon: string; label: string }[] = [
|
|
1533
1534
|
{value: '', icon: 'align-left@lu', label: 'Align left'},
|
|
1534
1535
|
{value: 'center', icon: 'align-center@lu', label: 'Align center'},
|
|
1535
1536
|
{value: 'right', icon: 'align-right@lu', label: 'Align right'},
|
|
@@ -1558,7 +1559,8 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1558
1559
|
<span>Alignment</span>
|
|
1559
1560
|
<zn-button-group>
|
|
1560
1561
|
${aligns.map(align => html`
|
|
1561
|
-
<zn-button
|
|
1562
|
+
<zn-button icon-button="small"
|
|
1563
|
+
icon=${align.icon}
|
|
1562
1564
|
?plain=${data.align !== align.value}
|
|
1563
1565
|
tooltip=${align.label}
|
|
1564
1566
|
@click=${() => this.updateImageEdit({align: align.value})}></zn-button>`)}
|
|
@@ -1581,12 +1583,15 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1581
1583
|
</label>
|
|
1582
1584
|
</div>
|
|
1583
1585
|
<div class="remarkd-editor__image-buttons">
|
|
1584
|
-
<zn-button
|
|
1585
|
-
<zn-button
|
|
1586
|
+
<zn-button color="primary" size="small" @click=${this.saveImageEdit}>Save</zn-button>
|
|
1587
|
+
<zn-button color="secondary" size="small" @click=${this.closeImageEdit}>Cancel</zn-button>
|
|
1586
1588
|
<span class="remarkd-editor__image-buttons-spacer"></span>
|
|
1587
|
-
<zn-button
|
|
1588
|
-
|
|
1589
|
-
|
|
1589
|
+
<zn-button icon-button="small"
|
|
1590
|
+
plain
|
|
1591
|
+
icon="code@lu"
|
|
1592
|
+
tooltip="Edit source"
|
|
1593
|
+
@click=${this.editImageSource}></zn-button>
|
|
1594
|
+
<zn-button icon-button="small" plain icon="trash-2@lu" color="error"
|
|
1590
1595
|
tooltip="Delete image" @click=${this.deleteImageBlock}></zn-button>
|
|
1591
1596
|
</div>
|
|
1592
1597
|
</div>`;
|
|
@@ -1744,12 +1749,19 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1744
1749
|
@pointerdown=${this.handleHandlePointerDown}>
|
|
1745
1750
|
<zn-icon src="grip-vertical@lu" size="16"></zn-icon>
|
|
1746
1751
|
</span>
|
|
1747
|
-
<zn-button
|
|
1752
|
+
<zn-button icon-button="small"
|
|
1753
|
+
plain
|
|
1754
|
+
icon="plus@lu"
|
|
1755
|
+
icon-size="16"
|
|
1748
1756
|
tooltip="Add block below"
|
|
1749
1757
|
@click=${() => this.insertDraftBlock(index + 1)}></zn-button>
|
|
1750
1758
|
</div>
|
|
1751
1759
|
<zn-button class="remarkd-editor__delete"
|
|
1752
|
-
|
|
1760
|
+
icon-button="small"
|
|
1761
|
+
plain
|
|
1762
|
+
icon="x@lu"
|
|
1763
|
+
icon-size="16"
|
|
1764
|
+
color="error"
|
|
1753
1765
|
tooltip="Delete block"
|
|
1754
1766
|
@click=${() => this.deleteBlock(index)}></zn-button>`}
|
|
1755
1767
|
<div part="rendered"
|
|
@@ -1808,7 +1820,10 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1808
1820
|
/** A single toolbar action button, shared by the toolbar bar and the overflow menu. */
|
|
1809
1821
|
private renderAction(action: EditorAction) {
|
|
1810
1822
|
return html`
|
|
1811
|
-
<zn-button
|
|
1823
|
+
<zn-button icon-button="small"
|
|
1824
|
+
plain
|
|
1825
|
+
icon=${action.icon}
|
|
1826
|
+
icon-size="18"
|
|
1812
1827
|
tooltip=${action.label}
|
|
1813
1828
|
?disabled=${this.isActionDisabled(action)}
|
|
1814
1829
|
@mousedown=${(e: MouseEvent) => e.preventDefault()}
|
|
@@ -1869,8 +1884,12 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1869
1884
|
// the textarea out from under it.
|
|
1870
1885
|
if (!this.linkPickerOpen) this.suppressBlurCommit = false;
|
|
1871
1886
|
}}>
|
|
1872
|
-
<zn-button slot="trigger"
|
|
1873
|
-
icon-
|
|
1887
|
+
<zn-button slot="trigger"
|
|
1888
|
+
icon-button="small"
|
|
1889
|
+
plain
|
|
1890
|
+
icon="ellipsis@lu"
|
|
1891
|
+
icon-size="18"
|
|
1892
|
+
tooltip="More"
|
|
1874
1893
|
@mousedown=${(e: MouseEvent) => e.preventDefault()}></zn-button>
|
|
1875
1894
|
<zn-menu>
|
|
1876
1895
|
${overflowed.flatMap(entry => entry.actions).map(action => this.renderMenuAction(action))}
|
|
@@ -1878,8 +1897,11 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1878
1897
|
</zn-dropdown>` : ''}`;
|
|
1879
1898
|
})()}
|
|
1880
1899
|
${this.allowRaw ? html`
|
|
1881
|
-
<zn-button part="raw-toggle"
|
|
1882
|
-
|
|
1900
|
+
<zn-button part="raw-toggle"
|
|
1901
|
+
class="remarkd-editor__raw-toggle"
|
|
1902
|
+
icon-button="small"
|
|
1903
|
+
icon="code-xml@lu"
|
|
1904
|
+
icon-size="18"
|
|
1883
1905
|
?plain=${!this.rawMode}
|
|
1884
1906
|
tooltip=${this.rawMode ? 'Show blocks' : 'Show raw source'}
|
|
1885
1907
|
@click=${this.toggleRawMode}></zn-button>` : ''}
|
|
@@ -1944,12 +1966,17 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1944
1966
|
@input=${(e: Event) => {
|
|
1945
1967
|
this.includeQuery = (e.target as HTMLInputElement).value;
|
|
1946
1968
|
}}>
|
|
1947
|
-
<zn-button
|
|
1948
|
-
|
|
1969
|
+
<zn-button icon-button="small"
|
|
1970
|
+
plain
|
|
1971
|
+
icon="x@lu"
|
|
1972
|
+
tooltip="Cancel"
|
|
1973
|
+
@click=${this.closeIncludePicker}></zn-button>
|
|
1949
1974
|
</div>
|
|
1950
1975
|
${this.includeOptions === null
|
|
1951
|
-
? html
|
|
1952
|
-
|
|
1976
|
+
? html`
|
|
1977
|
+
<div class="remarkd-editor__include-picker-empty">${
|
|
1978
|
+
this.includeLoadFailed ? 'Could not load Includes' : 'Loading…'}
|
|
1979
|
+
</div>`
|
|
1953
1980
|
: items.length
|
|
1954
1981
|
? items.map(item => html`
|
|
1955
1982
|
<button type="button" class="remarkd-editor__include-option"
|
|
@@ -1959,7 +1986,8 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1959
1986
|
<span class="remarkd-editor__include-option-meta">${item.scope ?? ''}${
|
|
1960
1987
|
item.languages ? ` · ${item.languages}` : ' · No content'}</span>
|
|
1961
1988
|
</button>`)
|
|
1962
|
-
: html
|
|
1989
|
+
: html`
|
|
1990
|
+
<div class="remarkd-editor__include-picker-empty">No Includes found</div>`}
|
|
1963
1991
|
</div>`;
|
|
1964
1992
|
}
|
|
1965
1993
|
|
|
@@ -1975,12 +2003,17 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1975
2003
|
this.linkQuery = (e.target as HTMLInputElement).value;
|
|
1976
2004
|
this.searchLinks(this.linkQuery);
|
|
1977
2005
|
}}>
|
|
1978
|
-
<zn-button
|
|
1979
|
-
|
|
2006
|
+
<zn-button icon-button="small"
|
|
2007
|
+
plain
|
|
2008
|
+
icon="x@lu"
|
|
2009
|
+
tooltip="Cancel"
|
|
2010
|
+
@click=${this.closeLinkPicker}></zn-button>
|
|
1980
2011
|
</div>
|
|
1981
2012
|
${this.linkResults === null
|
|
1982
|
-
? html
|
|
1983
|
-
|
|
2013
|
+
? html`
|
|
2014
|
+
<div class="remarkd-editor__link-picker-empty">${
|
|
2015
|
+
this.linkSearchFailed ? 'Could not search for articles' : 'Searching…'}
|
|
2016
|
+
</div>`
|
|
1984
2017
|
: this.linkResults.length
|
|
1985
2018
|
? this.linkResults.map(item => html`
|
|
1986
2019
|
<button type="button" class="remarkd-editor__link-option"
|
|
@@ -1990,7 +2023,8 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
1990
2023
|
[kinds[item.kind] ?? item.kind, item.context, item.status === 'published' ? '' : item.status]
|
|
1991
2024
|
.filter(Boolean).join(' · ')}</span>
|
|
1992
2025
|
</button>`)
|
|
1993
|
-
: html
|
|
2026
|
+
: html`
|
|
2027
|
+
<div class="remarkd-editor__link-picker-empty">No articles found</div>`}
|
|
1994
2028
|
</div>`;
|
|
1995
2029
|
}
|
|
1996
2030
|
|
|
@@ -2024,7 +2058,9 @@ export default class ZnRemarkdEditor extends ZincElement implements ZincFormCont
|
|
|
2024
2058
|
accept="image/*"
|
|
2025
2059
|
droparea
|
|
2026
2060
|
@zn-change=${this.handleImagePicked}></zn-file>
|
|
2027
|
-
<zn-button
|
|
2061
|
+
<zn-button icon-button="small"
|
|
2062
|
+
plain
|
|
2063
|
+
icon="x@lu"
|
|
2028
2064
|
tooltip="Cancel"
|
|
2029
2065
|
@click=${this.closeImagePicker}></zn-button>
|
|
2030
2066
|
</div>`;
|