M
M
Michael2017-03-25 18:02:44
ASP.NET
Michael, 2017-03-25 18:02:44

How to save text edited in TinyMce the next time you visit a page without a database?

Hello. I have a simple block of text that is, let's say, wrapped in tags. And I want to edit this text as much as possible, the choice fell on the tinyMce editor. I found a tutorial where they showed how to display the text that you enter in the editor itself in a field, for example textarea, and for this I used the simplest code in the controller

public ActionResult Index()
        {
            return View();
        }
 
        // An action that will accept your Html Content
        [HttpPost]
        public ActionResult Index(ExampleClass model)
        {
            return View();
        }
 
 
public class ExampleClass  
{
        // This attributes allows your HTML Content to be sent up
        [AllowHtml]
        public string HtmlContent { get; set; }
 
        public ExampleClass()
        {
 
        }
}

, and so the text perfectly displays with one, but when you leave the page and return to it back, the text disappears. (both in the editor itself and in the output). Is it possible to stir up this matter somehow without a database, so as not to create a table separately for a static html block ?? For example, when we returned back to the page, the text that we edited should be saved. They said to use localStorage https://www.tinymce.com/docs/api/tinymce.util/tinymce .. but to be honest, I didn’t understand much from the docs without an example. I'm trying to tie all this into MVC. How can you do it? Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Nazarov, 2017-03-25
@vnaz

put in a file on the server

F
flafy4, 2017-03-25
@flafy4

Write to cookies, or to the session.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question