Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(content): add agx support for injectContent #1012

Merged
merged 10 commits into from
Apr 8, 2024

Conversation

joshuamorony
Copy link
Contributor

@joshuamorony joshuamorony commented Apr 7, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • vite-plugin-angular
  • vite-plugin-nitro
  • astro-angular
  • create-analog
  • router
  • platform
  • content
  • nx-plugin
  • trpc

What is the current behavior?

Using a .agx file currently requires manually importing/creating the component, e.g:

  defineMetadata({
    queries: {
      divPost: new ViewChild('post', { static: true, read: ViewContainerRef }),
    }
  });

  let divPost: ElementRef<HTMLDivElement>;
  const cdr = inject(ChangeDetectorRef);

  afterNextRender(() => {
    const postId = 'post';
    import(`../../content/${postId}.agx`).then(m => {
      divPost.createComponent(m.default);
      cdr.detectChanges();
    });
  });

What is the new behavior?

.agx files can be used in the same manner as .md files with injectContent, e.g:

  const post$ = injectContent({
    customFilename: 'post'
  });
  const post = toSignal(post$)
<analog-markdown [content]="post().content"></analog-markdown>

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit 336fea9
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/66137aee6552f70008a0a3cc
😎 Deploy Preview https://deploy-preview-1012--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit 336fea9
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/66137aee43a9d10008758446
😎 Deploy Preview https://deploy-preview-1012--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 336fea9
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/66137aeef92d6d0008fa3b58
😎 Deploy Preview https://deploy-preview-1012--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for analog-ng-app ready!

Name Link
🔨 Latest commit 336fea9
🔍 Latest deploy log https://app.netlify.com/sites/analog-ng-app/deploys/66137aee12e95e0008db0d5c
😎 Deploy Preview https://deploy-preview-1012--analog-ng-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@nartc nartc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

packages/content/src/lib/markdown.component.ts Outdated Show resolved Hide resolved
packages/content/src/lib/markdown.component.ts Outdated Show resolved Hide resolved
packages/content/src/lib/content.ts Outdated Show resolved Hide resolved
@joshuamorony joshuamorony marked this pull request as ready for review April 8, 2024 05:08
@brandonroberts brandonroberts merged commit 62f0f86 into analogjs:beta Apr 8, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants