Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ufodisko's avatar

How to preserve data in TinyMCE when navigating to other pages

I have a TinyMCE editor on a page that has multiple forms, each form is being shown based on the query parameter of the URL.

For example /posts?type=press-release I show the press release form.

The forms have the same fields but the query being submitted to the database gets changed depending on the query parameter.

When I write something inside the tinymce editor and submit a form and redirect back, the content inside the editor remains which is what I want.

return redirect()->back()->with('message', 'Post submitted successfully.');

But when I navigate to other URLs, the content gets removed.

I'm not sure how to approach this problem. Whatever advice and recommendations you have are appreciated.

I am navigating with Inertia's Link

<jet-nav-link :href="route('posts', {'type': 'press-release'})" :active="route().current('writer', { 'type': 'press-release' })">
    Press Release
 </jet-nav-link>

And inside the Posts view

<editor api-key="no-api-key" :init="{
    height: 500,
    menubar: false,
    plugins: [
        'advlist autolink lists link image charmap print preview anchor',
        'searchreplace visualblocks code fullscreen',
        'insertdatetime media table paste code help wordcount'
    ],
    toolbar:
        'formatselect | bold italic | \
        alignleft aligncenter alignright alignjustify | \
        bullist numlist outdent indent | removeformat | help'
}" />

I'm using the official Tinymce package https://github.com/tinymce/tinymce-vue

0 likes
0 replies

Please or to participate in this conversation.