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

Please allow for vanilla javascript #88

Open
tiagorangel1 opened this issue Jun 5, 2024 · 10 comments
Open

Please allow for vanilla javascript #88

tiagorangel1 opened this issue Jun 5, 2024 · 10 comments

Comments

@tiagorangel1
Copy link

I would love to use this, but the app I'm working on uses vanilla javascript. No frameworks, no fancy stuff.

@flatsiedatsie
Copy link

Related: #87

@davidmyersdev
Copy link
Owner

@tiagorangel2011 I'm not sure what you mean. The core library is already built to work with vanilla JS.

@davidmyersdev davidmyersdev closed this as not planned Won't fix, can't repro, duplicate, stale Jul 2, 2024
@flatsiedatsie
Copy link

That's wonderul news.

Could you perhaps create a tiny example for that use case? How would I use the library to generate a minimal text area and UI?

@tiagorangel1
Copy link
Author

Using the HTML provided in the README results in a error (see #87)

  <div id="editor"></div>
  <script type="module">
	  import { ink } from 'https://esm.sh/ink-mde@0.22.0';
	  ink(document.getElementById('editor')!);
  </script>
330915941-8d0a12de-ea98-42cc-888f-54d5a7333574

@flatsiedatsie
Copy link

Using the HTML provided in the README results in a error (see #87)

  <div id="editor"></div>
  <script type="module">
	  import { ink } from 'https://esm.sh/ink-mde@0.22.0';
	  ink(document.getElementById('editor')!);
  </script>
330915941-8d0a12de-ea98-42cc-888f-54d5a7333574

Yes, that was the exact same issue I was having: #87

@davidmyersdev
Copy link
Owner

@tiagorangel2011 @flatsiedatsie it sounds like there might be an issue with the esm.sh service then. If you install it via NPM, I think it would work. I'll open this back up to investigate that service though.

@davidmyersdev davidmyersdev reopened this Aug 24, 2024
@flatsiedatsie
Copy link

Wonderful, thank you!

Would it perhaps be possible to provide a single-file version of the library? For privacy protection reasons I can't use a CDN, the library files must be provided from the same server as the rest of the project. I've tried downloading the files form ESM, but that's quite hard to do, because it links to many other files, and those link to yet more files, etc.

@davidmyersdev
Copy link
Owner

@flatsiedatsie a single file version might be possible, but it would be pretty large due to the various dynamic imports that are used for code block language parsers, optional features, etc. It'd be better to install it via NPM and bundle it with something like Vite if that's possible.

@tiagorangel1
Copy link
Author

tiagorangel1 commented Sep 19, 2024

how am I supposed to link it after installing with npm? this:

<div id="editor"></div>
<script type="module">
  import { ink } from '/node_modules/ink-mde/dist/index.js'
  
  ink(document.getElementById('editor'))</script>

plus basic HTTP server returns in error Uncaught TypeError: The specifier “solid-js/web” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.

sorry I'm kinda of a noob when it comes to this kind of stuff. I really don't want to use anything like vite

@flatsiedatsie
Copy link

@davidmyersdev Thanks

It'd be better to install it via NPM and bundle it with something like Vite if that's possible.

Unfortunately that's not possible. I'm trying to integrate it into an existing plain JS project. And like the poster above, I know nothing about Vite either.

it would be pretty large due to the various dynamic imports

That's no issue. The project loads multiple gigabytes of AI files (.gguf) to the browser, so large is very relative in my case :-)

Screenshot 2024-09-12 at 12 45 04

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

No branches or pull requests

3 participants