PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

How can i add Tiny MCE to a view

Solved
ngatsejacques

May 1st, 2022 11:57 PM

Hi, I'm following all the step of a tutorial, but they doesn't talk about adding a tiny MCE form on a view ? Especially since we're using voyager on Wave.

Can somebody help me ?

I've found another one but it's an iframe, so i can't add dynamique data on it.

And another question, how can i :

  1. hide my JS script by encrypting it ? (i don't want people to see my functions)
  2. use a laravel .env variable in my app.js ?

Thanks

bobbyiliev

May 2nd, 2022 12:49 AM

Hey,

As per their docs here, I would just use the self-hosted JS file by downloading it from here:

https://www.tiny.cloud/get-tiny/self-hosted/

Then add the JS file to your Laravel /public folder and include that JS file in your HTML:

<script src="/path/or/uri/to/tinymce.min.js" referrerpolicy="origin"></script>

Then you can use it as normal in that specific blade view that you've included it to.

Regarding the environment variables, you can follow the steps here:

Compiling Assets (Mix)

Quote:

You may inject environment variables into your webpack.mix.js script by prefixing one of the environment variables in your .env file with MIX_:

MIX_SENTRY_DSN_PUBLIC=http://example.com

After the variable has been defined in your .env file, you may access it via the process.env object. However, you will need to restart the task if the environment variable's value changes while the task is running:

process.env.MIX_SENTRY_DSN_PUBLIC

Regarding encrypting your JS code, I'm not 100% sure that there is a guaranteed way of doing this. But you can give the following a try:

JavaScript Obfuscator Tool

ngatsejacques

May 5th, 2022 01:22 AM

Hi,

I tried to do what you said about .env but it's still not working

i renamed my var in .env with MIX_MY_VAR=onetoken

Then tried to use it in my app.js as process.env.MIX_MY_VAR but it always undefined.

Should i load some files or another thing ? And i don't need to touch the webpack.min.js right ?

Thanks

bobbyiliev

May 5th, 2022 01:51 AM

Did you add the env variable to the following file:

resources/views/themes/tallstack/.env
ngatsejacques

May 5th, 2022 02:05 AM

There was none, i tried to create one but it's the same, still not working

bobbyiliev

May 5th, 2022 02:12 AM

Best Answer

I just tried it and it seems to be working.

Did you run npm run production after you added the new .env file with the MIX_ env variable?

ngatsejacques

May 7th, 2022 03:39 AM

I was on npm run watch, i needed to relaunch npm run production like you said. Thanks

Report
1
bobbyiliev

May 7th, 2022 03:55 AM

No problem at all! Happy to hear that you've got it working!