tinymce paste text with color - tinymce

I'm using the paste plugin in my tinymce editor.
when i'm pasting a text inside of it (from a word document for example) , the text is copied but without it's color.
how can I paste the text with it's color?
Thank's In Advance.

Ok, i suggest you use the paste plugin then.
The paste plugin has a very usefull setting called paste_retain_style_properties.
Using this parameter you may define what styles you wish to keep.
You can select 'all' to keep all styles settings or use a comma-separated list.

Related

Fix issue with VS Code: Border around all whitespaces in lines of code

All my whitespaces in VS code where code is written are being highlighted and I cant seem to understand where to change these settings.
In settings (open Command Palette CTRL+SHIFT+P and search for settings) menu search for Editor: Render Whitespace it is probably set to all instead of default selection. But i honestly have no idea why it is render with boxes and not dots or arrows, maybe it can be customized by using custom themes.
It was probably because of the theme the source was using from where I copied the source code. Replaced all these spaces with regular whitespace and now it's working fine.

Tinymce 4: how to allow converting pasted content to plain text AND to normal mode

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.

Temporarily inlay text in Eclipse CEditor

I am creating an Eclipse plugin. It creates custom Problem markers. What I would like to do is inlay text at the marker location in the CEditor to give the user information. Basically add a comment, but I do not want these comments saved when the user saves the file. Is there a way to do this in Eclipse or is there a plugin that I can use to do this? Thank you in advance.
I have solved this. It can be done by treating the editor as a styledText area. With this other controls can be added to the styledText area. I just added a label with my text. Since the label is not part of the actual file it does not get saved with the file. Upon close of the file in the editor the label is disposed and the underlying file is left unmodified by the addition of the label.

Tinymce selects code

On the tinymce editor there is this code
// Theme options
"styleselect,formatselect,fontselect,fontsizeselect",
Are this select boxes
styleselect,formatselect,fontselect,fontsizeselect
part of a plugin or are they in a separate .js file.
I solved it this way.I opened
/var/www/tinymce/jscripts/tiny_mce/themes/advanced/editor_template.js
and i knew what advanced control was named for instance theme_advanced_blockformats:
This is the control with the block formats.To change their display names i put in this code
theme_advanced_blockformats : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1",
and it worked.
There is that topic on tinymce website on theme_advanced_styles which serves as an excellent example http://www.tinymce.com/wiki.php/Configuration:theme_advanced_styles

TinyMCE past image from MS Word

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.