How to initialize tinymce as plain-text editor - plaintext

I want to use the tinymce editor for visualizing special chars like a paragraph like this: ΒΆ
It should only visualize it. The value of the input should contain only plain text.
Is there a setup param to force tinymce to work in plain text mode?

You can retrieve content from the TinyMCE editor as HTML or plaintext. To retrieve the content as plaintext specify format: 'text' when you get the content. For example:
// Get the contents of the currently active editor as plain text
tinymce.activeEditor.getContent({format: 'text'});
For more information about getContent, see: https://www.tiny.cloud/docs/api/tinymce/tinymce.editor/#getcontent.

Related

how to extract text by style in openoffice

I have an openoffice text using different styles. I need to extract all text in one style as a text .txt file (but not including text marked in the other styles). How can this be achieved?
I tried to mark other styles as hidden and save as .txt, but the result contains all text, not only the one which is visible. If I save as .pdf and then cut and paste the text from I get what I need, but this seems a roundabout solution and I am certain a better one exists.
To select all text with a certain paragraph style, go to Edit -> Find & Replace. Expand Other options and check Paragraph Styles. Then select the style name to Find and press Find All.
Now close the dialog. Copy and paste to a text editor such as Notepad (depending on your operating system). Then save the text file from the text editor.
For character styles, this will not work, so use AltSearch.

Copy text in flutter along with text styling

The textview in flutter has some styling(Font family,color,style etc) and when I try to copy the text, only the text value gets copied but I need styling also.
styling properties are given to display text in given Style it is not the property of text.
Text is copied in UTF byte Format
so, When you copy text Only text gets copied the style and Other property does not get copied.

Add HTML but not in text mode of TinyMCE

I have a big text and like to highlight words that are trademarks. So within this big CDATA node I need to grab for multiple words like "ACME Soda Chips" and make them red.
currently I do something like this in a TinyMCE plugin:
// almost ...
var foo = editor.getContent();
foo.replace('ACME Soda Chips', '<span class="douh">ACME Soda Chips</span>');
editor.setContent(foo);
My problem now is, that such HTML is displayed in Text-Mode (where you see the content as plain HTML) and also submitted therefor stored to the database.
But what I like to have is:
Highlight a word in the visual mode
Do not store my surrounding span somehow
Optional: Do not show that I used a span and CSS-class to highlight things.
Hint:
I may completely do this wrong - please help.
I read some other plugins and honestly I don't understand what they do.
Imagine the whole text as one single big CDATA part but I like to highlight a specific set out of it.

How to insert a new Word style into a RMarkdown file

Is there a simple way to do this using Knitr without using Pandoc? I tried adding some HTML <DIV Class="newStyle>&nbsp</div> into an .Rmd file, but the style didn't show up in the generated Word .docx.
Thanks, Sue.
My setup: Office 365 Pro Plus, RStudio 1.0.143.
I was able to get both the <div> and <span> syntax to work. First I created a new style in my reference.docx document with the same name I intended to use in the Pandoc markup tags. Careful what you name the style -- this worked when I used the name "SpanAdd" but did not work with the name "Span_Add." The <div> tag should be used when you want to specify a paragraph style -- the default "Linked Paragraph and Character" style type in Word works fine for this. However, the <span> tag is more finicky and I was only able to get it to work with a "Character" style type. I based my character styles on "Default Paragraph Text."
Anyway, once I modified a new style in the reference document and saved it, I was able to use these tags within an .Rmd file to generate marked-up text.

tinymce removes line breaks so all text is in a continuous chunk with no paragraphs

I'm using TinyMce textarea editor and have a problem. As you probably know Tinymce transforms a standard html textarea into a rich text editor.
On our 'edit listing' page we call up some text from our db for the user to edit (previously in a standard textarea, now in the tinymce textarea.
Previously the standard textarea would preserve linebreaks and the user would get several paragraphs of text in the text area, now with tinyMCE they get a huge chunk of text with no linebreaks. (I have pasted an example of an entry in our db below - as you can see it has line breaks in it by tinymce seems to be ignoring them when it displays them in the editor).
Just to clarify my issue is now that tinymce is stripping something when I submit the form, it's that when I pull text (that contains line breaks) from the db and populate the tinymce textarea with that data (for the user to edit) in the tinymce textarea - the text appears (in the tinymce textarea) as one massive chunk of text with my paragraphs (whereas in a standard textarea it is nicely formatted with linebreaks)
Any help on how to resolve this would be greatly appreciated - do I need to use some sort of populate() type function to put the text in, or maybe I need to replace all the linebreaks with a different special character that tinyMCE will recognise as a line break and preserve?..
Thanks in advance.
Nick
example from db:
Here is line one
Here is line two
And here is line three
Which appears in tinymce as:
Here is line one Here is line two And here is line three
I faced a similar a problem, a while back and had questions just like yours. Also I finally ended up on SE just like you.
Anyway, I think I have the solution to your problem. If you are using PHP as your server side language, then you should use nl2br() PHP function.
Suppose you have stored your content fetched from the database in a php variable. Something like this:
$content = $row['content'];
Now when displaying it on to your screen, use the nl2br() function.
echo nl2br("<p>".$content."<p>");
Now, this part inside () depends on how you want to output the data. And I will leave it to you to figure that part out.
Hope this helps.