FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(sanity): preserve Angular 18 template compatibility by osnoser1 · Pull Request #64 · limitless-angular/limitless-angular · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .mjs  (1) .ts  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ function getInsertMenuOptions(
@if (previewImageUrl(schemaType); as previewImage) {
<img class="preview-image" [src]="previewImage" alt="" />
} @else {
@let icon = iconFor(schemaType);
<span class="icon" [attr.aria-label]="icon.label">
@if (icon.html) {
<span [innerHTML]="icon.html"></span>
} @else {
{{ icon.text }}
}
</span>
@if (iconFor(schemaType); as icon) {
<span class="icon" [attr.aria-label]="icon.label">
@if (icon.html) {
<span [innerHTML]="icon.html"></span>
} @else {
{{ icon.text }}
}
</span>
}
}
<span class="label">{{ labelFor(schemaType) }}</span>
</button>
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ type ContextMenuState = NonNullable<OverlayState['contextMenu']>;
#menu
>
<div class="header">
@let icon = titleIcon();
<span class="icon" [attr.aria-label]="icon.label">
@if (icon.html) {
<span [innerHTML]="icon.html"></span>
} @else {
{{ icon.text }}
}
</span>
@if (titleIcon(); as icon) {
<span class="icon" [attr.aria-label]="icon.label">
@if (icon.html) {
<span [innerHTML]="icon.html"></span>
} @else {
{{ icon.text }}
}
</span>
}
<span class="title">{{ title() }}</span>
</div>
@if (items(); as items) {
Expand Down
37 changes: 36 additions & 1 deletion tools/angular-compat/test-consumer.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,18 @@ import {
type PortableTextComponents,
toPlainText,
} from '@limitless-angular/sanity/portabletext';
import { LiveQueryProviderComponent } from '@limitless-angular/sanity/preview-kit';
import {
VisualEditingComponent,
VisualEditingInsertMenuComponent,
VisualEditingPointerEventsComponent,
VisualEditingUnionInsertMenuOverlayComponent,
type ElementNode,
type OverlayElementParent,
type SanityNode,
type SchemaNode,
type SchemaUnionNode,
} from '@limitless-angular/sanity/visual-editing';

const blocks = [
{
Expand All @@ -298,7 +310,15 @@ const sanityConfig = {
@Component({
selector: 'app-root',
standalone: true,
imports: [PortableTextComponent, SanityImage],
imports: [
PortableTextComponent,
SanityImage,
LiveQueryProviderComponent,
VisualEditingComponent,
VisualEditingInsertMenuComponent,
VisualEditingPointerEventsComponent,
VisualEditingUnionInsertMenuOverlayComponent,
],
template: \`
<p data-testid="compat-marker">{{ plainText }}</p>
<article
Expand All @@ -316,12 +336,27 @@ const sanityConfig = {
[sanityImage]="image"
priority
/>
<ng-template>
<live-query-provider />
<visual-editing />
<sanity-visual-editing-insert-menu [node]="insertMenuNode" />
<sanity-visual-editing-pointer-events />
<sanity-visual-editing-union-insert-menu-overlay
[element]="overlayElement"
[node]="overlayNode"
[parent]="overlayParent"
/>
</ng-template>
\`,
})
class AppComponent {
protected readonly blocks = blocks;
protected readonly components: Partial<PortableTextComponents> = {};
protected readonly image = 'image-abc123-120x80-png';
protected readonly insertMenuNode = {} as SchemaUnionNode<SchemaNode>;
protected readonly overlayElement = {} as ElementNode;
protected readonly overlayNode = {} as SanityNode;
protected readonly overlayParent = this.insertMenuNode as OverlayElementParent;
protected readonly plainText = toPlainText(blocks);
}

Expand Down
Loading

Back | FazBrowse Home | New Git URL