简体   繁体   中英

How to save TinyMCE as file?

Is there a package where can I save my work using file manager in TinyMCE? I watch several videos but they only have a tutorial on image upload. I cannot find any package that I can my work in any format available like pdf etc. I read the documentation but find out that there's no sample for this kind of toolbar.

As you can see below I have a save in my plugins and toolbar. But this is totally gray out because I can't still find any package for this.

<script>

tinymce.init
({
    selector: '#mytextarea',
    plugins: [
    'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker',
    'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
    'save table contextmenu directionality emoticons template paste textcolor save'
    ], //The plugins configuration option allows you to enable functionality within the editor.
    toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons | save',
    save_enablewhendirty: true,
    height: 400,
});

</script>

Content:

@section ('content')

<h3>Create Document</h3>
<div class = "col-md-12">
    <div class = "panel-body">
        <form class = "form-vertical" method="post">

            <div class = "form-group">
                <label for = "subject" class = "control-label">Subject:</label>
                <input type = "text" name = "subject" class = "form-control">
            </div>

            <div class = "form-group">
                <label for = "to" class = "control-label">To:</label>
                <input type = "text" name = "to" class = "form-control">
            </div>

            <div class = "form-group">
                <button type = "submit" class = "btn btn-success">Send</button>
            </div>
            <textarea id="mytextarea"></textarea>

        </form>
    </div>
</div>

@endsection

The TinyMCE save plugin is not a plugin to save / export in any of the format you're describing like pdf, doc, etc.

The TinyMCE save plugin only submit the form that the editor is within. Your current form is:

<form class = "form-vertical" method="post">

You have no action attribute in this line, you need to add an action to specifies where to send the form-data when the form is submitted.

When the form is submitted (or you can even add new buttons, one for each file type you want to support), you can send your data to a third-party script / service who will generates the document and return it for you.

You'll need in this case to use third-party conversion tools to generate these documents, TinyMCE does not have native plugins to do that, its only purpose is to edit a document in WYSIWYG mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM