markstream-angular 2.0.16 → 2.0.18
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.
|
@@ -1397,14 +1397,25 @@ class CodeBlockNodeComponent {
|
|
|
1397
1397
|
}
|
|
1398
1398
|
async copyCode() {
|
|
1399
1399
|
const text = this.resolvedCode;
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1400
|
+
const clipboardWriter = this.clipboardWriter ?? this.mergedProps.clipboardWriter;
|
|
1401
|
+
if (clipboardWriter) {
|
|
1402
|
+
try {
|
|
1403
|
+
await clipboardWriter(text);
|
|
1404
|
+
}
|
|
1405
|
+
catch {
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1405
1408
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1409
|
+
else {
|
|
1410
|
+
try {
|
|
1411
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText)
|
|
1412
|
+
await navigator.clipboard.writeText(text);
|
|
1413
|
+
else
|
|
1414
|
+
this.copyUsingTextarea(text);
|
|
1415
|
+
}
|
|
1416
|
+
catch {
|
|
1417
|
+
this.copyUsingTextarea(text);
|
|
1418
|
+
}
|
|
1408
1419
|
}
|
|
1409
1420
|
this.copied = true;
|
|
1410
1421
|
this.context?.events.onCopy?.(text);
|
|
@@ -1844,7 +1855,7 @@ ${configuredUnsafeCSS}`.trim(),
|
|
|
1844
1855
|
}
|
|
1845
1856
|
}
|
|
1846
1857
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.26", ngImport: i0, type: CodeBlockNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1847
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.26", type: CodeBlockNodeComponent, isStandalone: true, selector: "markstream-angular-code-block-node", inputs: { node: "node", context: "context", codeBlockOptions: "codeBlockOptions", props: "props" }, viewQueries: [{ propertyName: "editorHost", first: true, predicate: ["editorHost"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
1858
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.26", type: CodeBlockNodeComponent, isStandalone: true, selector: "markstream-angular-code-block-node", inputs: { node: "node", context: "context", codeBlockOptions: "codeBlockOptions", clipboardWriter: "clipboardWriter", props: "props" }, viewQueries: [{ propertyName: "editorHost", first: true, predicate: ["editorHost"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
1848
1859
|
<div
|
|
1849
1860
|
class="code-block-container"
|
|
1850
1861
|
[class.is-dark]="resolvedIsDark"
|
|
@@ -2255,6 +2266,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.26", ngImpo
|
|
|
2255
2266
|
type: Input
|
|
2256
2267
|
}], codeBlockOptions: [{
|
|
2257
2268
|
type: Input
|
|
2269
|
+
}], clipboardWriter: [{
|
|
2270
|
+
type: Input
|
|
2258
2271
|
}], props: [{
|
|
2259
2272
|
type: Input
|
|
2260
2273
|
}] } });
|
|
@@ -8667,7 +8680,7 @@ class NodeOutletComponent {
|
|
|
8667
8680
|
<markstream-angular-fallback-node *ngSwitchDefault [node]="fallbackNode" [context]="context" [indexKey]="indexKey" />
|
|
8668
8681
|
</ng-container>
|
|
8669
8682
|
</ng-template>
|
|
8670
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: i0.forwardRef(() => CommonModule) }, { kind: "directive", type: i0.forwardRef(() => i1.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgSwitch), selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgSwitchCase), selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgSwitchDefault), selector: "[ngSwitchDefault]" }, { kind: "component", type: i0.forwardRef(() => AdmonitionNodeComponent), selector: "markstream-angular-admonition-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => BlockquoteNodeComponent), selector: "markstream-angular-blockquote-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => CheckboxNodeComponent), selector: "markstream-angular-checkbox-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => CodeBlockNodeComponent), selector: "markstream-angular-code-block-node", inputs: ["node", "context", "codeBlockOptions", "props"] }, { kind: "component", type: i0.forwardRef(() => D2BlockNodeComponent), selector: "markstream-angular-d2-block-node", inputs: ["node", "context", "props"] }, { kind: "component", type: i0.forwardRef(() => DefinitionListNodeComponent), selector: "markstream-angular-definition-list-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => DynamicNodeHostComponent), selector: "markstream-angular-dynamic-node-host", inputs: ["component", "node", "context", "indexKey", "inputs"] }, { kind: "component", type: i0.forwardRef(() => EmojiNodeComponent), selector: "markstream-angular-emoji-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => EmphasisNodeComponent), selector: "markstream-angular-emphasis-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => FallbackComponent), selector: "markstream-angular-fallback-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => FootnoteAnchorNodeComponent), selector: "markstream-angular-footnote-anchor-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => FootnoteNodeComponent), selector: "markstream-angular-footnote-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => FootnoteReferenceNodeComponent), selector: "markstream-angular-footnote-reference-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => HardBreakNodeComponent), selector: "markstream-angular-hardbreak-node" }, { kind: "component", type: i0.forwardRef(() => HeadingNodeComponent), selector: "markstream-angular-heading-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => HighlightNodeComponent), selector: "markstream-angular-highlight-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => HtmlBlockNodeComponent), selector: "markstream-angular-html-block-node", inputs: ["node", "context"] }, { kind: "component", type: i0.forwardRef(() => HtmlInlineNodeComponent), selector: "markstream-angular-html-inline-node", inputs: ["node", "context"] }, { kind: "component", type: i0.forwardRef(() => ImageNodeComponent), selector: "markstream-angular-image-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => InfographicBlockNodeComponent), selector: "markstream-angular-infographic-block-node", inputs: ["node", "context", "props"] }, { kind: "component", type: i0.forwardRef(() => InlineCodeNodeComponent), selector: "markstream-angular-inline-code-node", inputs: ["node", "context", "indexKey", "typewriter", "fade"] }, { kind: "component", type: i0.forwardRef(() => InsertNodeComponent), selector: "markstream-angular-insert-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => LinkNodeComponent), selector: "markstream-angular-link-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => ListItemNodeComponent), selector: "markstream-angular-list-item-node", inputs: ["node", "context", "indexKey", "value"] }, { kind: "component", type: i0.forwardRef(() => ListNodeComponent), selector: "markstream-angular-list-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => MathBlockNodeComponent), selector: "markstream-angular-math-block-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => MathInlineNodeComponent), selector: "markstream-angular-math-inline-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => MermaidBlockNodeComponent), selector: "markstream-angular-mermaid-block-node", inputs: ["node", "context", "props"] }, { kind: "component", type: i0.forwardRef(() => ParagraphNodeComponent), selector: "markstream-angular-paragraph-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => PreCodeNodeComponent), selector: "markstream-angular-pre-code-node", inputs: ["node", "showLineNumbers", "whiteSpace"] }, { kind: "component", type: i0.forwardRef(() => ReferenceNodeComponent), selector: "markstream-angular-reference-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => StrikethroughNodeComponent), selector: "markstream-angular-strikethrough-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => StrongNodeComponent), selector: "markstream-angular-strong-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => SubscriptNodeComponent), selector: "markstream-angular-subscript-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => SuperscriptNodeComponent), selector: "markstream-angular-superscript-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => TableNodeComponent), selector: "markstream-angular-table-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => TextNodeComponent), selector: "markstream-angular-text-node", inputs: ["node", "context", "indexKey", "typewriter", "fade"] }, { kind: "component", type: i0.forwardRef(() => ThematicBreakNodeComponent), selector: "markstream-angular-thematic-break-node" }, { kind: "component", type: i0.forwardRef(() => VmrContainerNodeComponent), selector: "markstream-angular-vmr-container-node", inputs: ["node", "context", "indexKey"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
8683
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: i0.forwardRef(() => CommonModule) }, { kind: "directive", type: i0.forwardRef(() => i1.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgSwitch), selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgSwitchCase), selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgSwitchDefault), selector: "[ngSwitchDefault]" }, { kind: "component", type: i0.forwardRef(() => AdmonitionNodeComponent), selector: "markstream-angular-admonition-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => BlockquoteNodeComponent), selector: "markstream-angular-blockquote-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => CheckboxNodeComponent), selector: "markstream-angular-checkbox-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => CodeBlockNodeComponent), selector: "markstream-angular-code-block-node", inputs: ["node", "context", "codeBlockOptions", "clipboardWriter", "props"] }, { kind: "component", type: i0.forwardRef(() => D2BlockNodeComponent), selector: "markstream-angular-d2-block-node", inputs: ["node", "context", "props"] }, { kind: "component", type: i0.forwardRef(() => DefinitionListNodeComponent), selector: "markstream-angular-definition-list-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => DynamicNodeHostComponent), selector: "markstream-angular-dynamic-node-host", inputs: ["component", "node", "context", "indexKey", "inputs"] }, { kind: "component", type: i0.forwardRef(() => EmojiNodeComponent), selector: "markstream-angular-emoji-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => EmphasisNodeComponent), selector: "markstream-angular-emphasis-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => FallbackComponent), selector: "markstream-angular-fallback-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => FootnoteAnchorNodeComponent), selector: "markstream-angular-footnote-anchor-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => FootnoteNodeComponent), selector: "markstream-angular-footnote-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => FootnoteReferenceNodeComponent), selector: "markstream-angular-footnote-reference-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => HardBreakNodeComponent), selector: "markstream-angular-hardbreak-node" }, { kind: "component", type: i0.forwardRef(() => HeadingNodeComponent), selector: "markstream-angular-heading-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => HighlightNodeComponent), selector: "markstream-angular-highlight-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => HtmlBlockNodeComponent), selector: "markstream-angular-html-block-node", inputs: ["node", "context"] }, { kind: "component", type: i0.forwardRef(() => HtmlInlineNodeComponent), selector: "markstream-angular-html-inline-node", inputs: ["node", "context"] }, { kind: "component", type: i0.forwardRef(() => ImageNodeComponent), selector: "markstream-angular-image-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => InfographicBlockNodeComponent), selector: "markstream-angular-infographic-block-node", inputs: ["node", "context", "props"] }, { kind: "component", type: i0.forwardRef(() => InlineCodeNodeComponent), selector: "markstream-angular-inline-code-node", inputs: ["node", "context", "indexKey", "typewriter", "fade"] }, { kind: "component", type: i0.forwardRef(() => InsertNodeComponent), selector: "markstream-angular-insert-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => LinkNodeComponent), selector: "markstream-angular-link-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => ListItemNodeComponent), selector: "markstream-angular-list-item-node", inputs: ["node", "context", "indexKey", "value"] }, { kind: "component", type: i0.forwardRef(() => ListNodeComponent), selector: "markstream-angular-list-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => MathBlockNodeComponent), selector: "markstream-angular-math-block-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => MathInlineNodeComponent), selector: "markstream-angular-math-inline-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => MermaidBlockNodeComponent), selector: "markstream-angular-mermaid-block-node", inputs: ["node", "context", "props"] }, { kind: "component", type: i0.forwardRef(() => ParagraphNodeComponent), selector: "markstream-angular-paragraph-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => PreCodeNodeComponent), selector: "markstream-angular-pre-code-node", inputs: ["node", "showLineNumbers", "whiteSpace"] }, { kind: "component", type: i0.forwardRef(() => ReferenceNodeComponent), selector: "markstream-angular-reference-node", inputs: ["node"] }, { kind: "component", type: i0.forwardRef(() => StrikethroughNodeComponent), selector: "markstream-angular-strikethrough-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => StrongNodeComponent), selector: "markstream-angular-strong-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => SubscriptNodeComponent), selector: "markstream-angular-subscript-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => SuperscriptNodeComponent), selector: "markstream-angular-superscript-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => TableNodeComponent), selector: "markstream-angular-table-node", inputs: ["node", "context", "indexKey"] }, { kind: "component", type: i0.forwardRef(() => TextNodeComponent), selector: "markstream-angular-text-node", inputs: ["node", "context", "indexKey", "typewriter", "fade"] }, { kind: "component", type: i0.forwardRef(() => ThematicBreakNodeComponent), selector: "markstream-angular-thematic-break-node" }, { kind: "component", type: i0.forwardRef(() => VmrContainerNodeComponent), selector: "markstream-angular-vmr-container-node", inputs: ["node", "context", "indexKey"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
8671
8684
|
}
|
|
8672
8685
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.26", ngImport: i0, type: NodeOutletComponent, decorators: [{
|
|
8673
8686
|
type: Component,
|
|
@@ -9730,7 +9743,7 @@ function createEnhancedBlockShell(kind, label, source, showSourceDetails, option
|
|
|
9730
9743
|
badge.className = 'markstream-angular-enhanced-block__badge';
|
|
9731
9744
|
badge.textContent = label;
|
|
9732
9745
|
header.appendChild(badge);
|
|
9733
|
-
header.appendChild(createHeaderActions(source, options));
|
|
9746
|
+
header.appendChild(createHeaderActions(source, options, kind === 'code' ? options.codeBlockProps?.clipboardWriter : undefined));
|
|
9734
9747
|
wrapper.appendChild(header);
|
|
9735
9748
|
}
|
|
9736
9749
|
const body = document.createElement('div');
|
|
@@ -9752,7 +9765,7 @@ function createEnhancedBlockShell(kind, label, source, showSourceDetails, option
|
|
|
9752
9765
|
}
|
|
9753
9766
|
return { wrapper, body };
|
|
9754
9767
|
}
|
|
9755
|
-
function createHeaderActions(source, options) {
|
|
9768
|
+
function createHeaderActions(source, options, clipboardWriter) {
|
|
9756
9769
|
const actions = document.createElement('div');
|
|
9757
9770
|
actions.className = 'markstream-angular-enhanced-block__actions';
|
|
9758
9771
|
const copyButton = document.createElement('button');
|
|
@@ -9761,8 +9774,18 @@ function createHeaderActions(source, options) {
|
|
|
9761
9774
|
copyButton.textContent = 'Copy';
|
|
9762
9775
|
if (options.showTooltips !== false)
|
|
9763
9776
|
copyButton.title = 'Copy source';
|
|
9764
|
-
copyButton.addEventListener('click', () => {
|
|
9765
|
-
|
|
9777
|
+
copyButton.addEventListener('click', async () => {
|
|
9778
|
+
if (clipboardWriter) {
|
|
9779
|
+
try {
|
|
9780
|
+
await clipboardWriter(source);
|
|
9781
|
+
}
|
|
9782
|
+
catch {
|
|
9783
|
+
return;
|
|
9784
|
+
}
|
|
9785
|
+
}
|
|
9786
|
+
else {
|
|
9787
|
+
void copyText(source);
|
|
9788
|
+
}
|
|
9766
9789
|
options.onCopy?.(source);
|
|
9767
9790
|
});
|
|
9768
9791
|
actions.appendChild(copyButton);
|