I need to copy word text with image to my server through copy - paste function. For that purpose, I choose TinyMCE editor.
The editor works fine, when inserting from word just text. It also works fine, when inserting from word just picture (the picture shows in TinyMCE textarea).
However, when I copy paste word text together with image, only the text shows in textarea.
Is there any way around how to solve this issue?
Next problem is, is there a plugin for TinyMCE that would get the link to the image from TinyMCE textarea, when pasting, and save the image on server?
You should have a look at the tinymce paste plugin - this should be able to handle it.
Related
The new TINYMCE (version 4) allows the use of:
paste_as_text: true
The problem is that this enabled all pastes to be converted to plain text. I would to be able to do this: when the user pastes content directly to the tinymce it will always clean the content and convert it to plain text BUT if the user cliks a button a dialog appears so user can paste content in this dialog and tinymce wouldnt "touch" it, it would paste it directly to the editor.
ACTUALLY this was the default behaviour on 3.X versions, you could have a specific PASTE FROM WORD button (which actually worked for anything you wanted to paste) so you cold paste content from word and it and it would not get converted to plain text.
I see there is an external "powerful paste plugin" from tinymce but it's not free, so how can I solve this problem without having to purchase a plugin?
EDIT:
Even attaching event to the paste process I cannot change the paste_as_text dynamically like this, for example:
tinymce.settings.paste_as_text = false;
I can execute that line in my code with no errors but it produces no effect, I continue not being able to paste content without being simplified as plain text.
When you load the paste plugin by default it adds two items to the Edit menu:
Paste
Paste as Text
...so what you want is a standard part of the paste plugin. In TinyMCE 4 its exposed via the Edit Menu and not the Toolbar.
EDIT #1: If you add the pastetext button to the toolbar that allows you to toggle the paste function between Paste as Text and regular Paste. The button toggles the behavior that happens on a paste event. It does not behave exactly as things did in TinyMCE 3 (the behavior you describe in your question).
EDIT #2 - Programmatically changing this behavior
You can use code to toggle this setting but you need a couple of different calls to get what you need.
First, you need to determine what the current "mode" is for the paste plugin. For this you can use:
tinymce.activeEditor.plugins.paste.clipboard.pasteFormat
This will (based on the current TinyMCE release of 4.6.5) return one of three values: "html", "text", or undefined. I believe it always starts as undefined until you initiate the toggle once.
If you want to switch the behavior to the other mode you can do this:
tinymce.activeEditor.execCommand('mceTogglePlainTextPaste');
Note that is is a toggle - so whatever it was set to it will switch to the opposite mode. There is no exposed method call that you can use to force it to one mode or the other.
I'm using TinyMCE's codesample plugin. It works the first time and saves correctly into the database, but when opening the editor again, it either strips the code sample content (if it's "illegal") or places it outside of the codesample tags.
Saved Code:
<pre class="language-markup"><code><!DOCTYPE html></code></pre>
When loading the editor again:
<pre class="language-markup"><code></code></pre>
Should the content somehow be filtered before returning it to the editor? I assume it's because the editor is converting the escaped HTML back to normal tags first...seems a bit silly really.
Anyone know a workaround for this or encountered this before?
Thanks in advance
See this TinyMCE Fiddle:
http://fiddle.tinymce.com/ITfaab
It seems to load your example code back into the editor just fine. What are you doing differently?
In my app i'm use tinyMCE editor to create rich email content, but now I need also sent messages as plain text now. Did someone knew how to force tinyMCE to use as a simple text editor w o any content editing, and use \r\n as line breaker?
I'm really stack at this moment, and thinking about writing own simple text editor, based on textarea. Didn't find in tinyMCE docs any solution.
TinyMCE is an HTML editor - there is no option to turn it into a plain text editor. The best you could do with TinyMCE is to transform the HTML into plain text when saving the form.
Before CKEditor 4.5.1 it was possible to drag and drop images into the editor and save them as base64, at least in FireFox. This no longer seems to be possible. Dragging an image into the editor gives no result at all, whereas in other browsers the image is loaded into a new tab, which seems to suggest that in FireFox the process is entirely blocked.
It turns out that you can drag an image into the paste tool and save it as a base64 string. See: https://www.dokuwiki.org/plugin:ckgedit:drag_and_drop
I am creating a plugin for TinyMCE, which is basically a form that has a textarea in it. I want the user to be able to input formatted text in that textarea, using the TinyMCE editor. The problem is that I'm not able to 'enrich' the textarea element inside the dialog.htm file in any way. Does there exist a way to do such a thing?
Thanks in advance,
Tomor
I found a quick fix. I managed to put the editor in an iframe, following the suggestion in this post:
http://www.tinymce.com/forum/viewtopic.php?pid=84668#p84668
It seems a bit messy, but it works.