When i trying to paste some text from Word or Notepad to my WYSIWYG redactor (imperavi), it allocates every new line with <p></p> tags. Is it possible to configure it to mark new line with just <br/>?
I've tried with other redactors, but in every the same thing happens: new line in notepad - new paragraph in redactor.
(Browser: safari)
In FireFox everything is OK. New line - <br/>
Of course, you need to set the configuration:
tinyMCE.init({
...
force_br_newlines : true,
force_p_newlines : false,
forced_root_block : '' // Needed for 3.x
});
Related
TLDR Using the PASTE (not powerpaste) plugin from TinyMCE, I want to keep the "style" attribute from the clipboard when pasting; it appears to be in the clipboard; however, TinyMCE appears to be stripping it
I have content from a PDF (PDF can be downloaded here: https://www.docdroid.net/BtHGhjb/test-pdf) that, when copied from Preview (MacOS), inside the clipboard, the style attribute on the span wrapping the word Test copied, I can verify this by downloading the document linked from docdroid.net, and opening it in preview, selecting all and clicking copy. Then going to http://static.ephox.com/clipboard/clipboardtest.html and pasting, see below for a screenshot:
You can see that the span has a bunch of styles added including font-family, font-weight and font-size,
When I paste into TinyMCE, with which I have created a sample # https://codesandbox.io/s/charming-brook-khp1v?file=/src/App.js what's actually getting pasted is the span WITHOUT the style property. I want to retain that style property.
My configuration can be seen # https://codesandbox.io/s/charming-brook-khp1v?file=/src/App.js otherwise it is:
menubar: false,
valid_classes: "column",
paste_retain_style_properties: "all",
spellchecker_language: "en",
paste_preprocess: (plugin, args) => {
console.log(args);
},
selector: "textarea",
advlist_bullet_styles: "square",
valid_elements: "span[style],b"
Any help on how I can retain the style property would be appreciated.
paste_webkit_styles: "font-weight"
fixes it for me
I have a problem with intellisense
I have disabled all extensions, but I still get:
sorry, but there is no formatter for html-files installed
any idea?
VS Code version 1.19.1
// Enable/disable autoclosing of HTML tags.
"html.autoClosingTags": true,
// List of tags, comma separated, where the content shouldn't be reformatted. 'null' defaults to the 'pre' tag.
"html.format.contentUnformatted": "pre,code,textarea",
// Enable/disable default HTML formatter
"html.format.enable": true,
// End with a newline.
"html.format.endWithNewline": false,
// List of tags, comma separated, that should have an extra newline before them. 'null' defaults to "head, body, /html".
"html.format.extraLiners": "head, body, /html",
// Format and indent {{#foo}} and {{/foo}}.
"html.format.indentHandlebars": false,
// Indent <head> and <body> sections.
"html.format.indentInnerHtml": false,
// Maximum number of line breaks to be preserved in one chunk. Use 'null' for unlimited.
"html.format.maxPreserveNewLines": null,
// Whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.
"html.format.preserveNewLines": true,
// List of tags, comma separated, that shouldn't be reformatted. 'null' defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.
"html.format.unformatted": "wbr",
// Wrap attributes.
"html.format.wrapAttributes": "auto",
// Maximum amount of characters per line (0 = disable).
"html.format.wrapLineLength": 120,
// Configures if the built-in HTML language support suggests Angular V1 tags and properties.
"html.suggest.angular1": true,
// Configures if the built-in HTML language support suggests HTML5 tags, properties and values.
"html.suggest.html5": true,
// Configures if the built-in HTML language support suggests Ionic tags, properties and values.
"html.suggest.ionic": true,
// Traces the communication between VS Code and the HTML language server.
"html.trace.server": "off",
// Configures if the built-in HTML language support validates embedded scripts.
"html.validate.scripts": true,
// Configures if the built-in HTML language support validates embedded styles.
"html.validate.styles": true,
Thanks
I had the same problem with VSC version 1.30. These steps solved my problem:
Press Ctrl+K Ctrl+O to select the folder in which the html file lies.
Open the File Explorer Ctrl+Shift+E and open the html file
Press Ctrl+Shift+I.
Viola! I got the formatted code
When I encountered this I was working with a single html file that was not in an opened folder nor VSC workspace. When I setup a workspace that included the file, the html formatter worked.
This happened to me because I had multiple formatters installed and I needed to configure which formatter to use. I ended up just uninstalling the one I didn't want anymore and it went back to working.
I am using TinyMCE 4.x version, BBCode as a source in my project. Below is the TinyMCE init code for it,
tinymce.init({
mode: "textareas",
editor_selector: "mceEditor",
resize: "both",
forced_root_block: false,
remove_redundant_brs : false,
verify_html : false,
force_br_newlines: true,
force_p_newlines: false,
remove_redundant_brs : false,
remove_linebreaks : false,
valid_elements: 'br',
plugins: ["autolink link image anchor bbcode code noneditable"],
toolbar: "bold italic link | code | bbcode",
});
If I add newline or extra line/space at the end of content and trying to get content from javascript(tinyMCE.activeEditor.getElement().val()), the content got is in trimmed form. Is there anyway to stop trimming the right trim of the content while we get content from TinyMCE?
I have tried different options from this: Linebreaks in TinyMCE editor show extra line on preview, not in code, tinymce remove text spaces and line breaks link but options does not worked for me.
Does anyone has an idea what changes that I need to make to overcome from this issue?
I had similar issue.
solved it with hakish solution ( no tinyMCE documentation for it anywhere) adding below settings inside tinymce.init({... solve the issues for me
indent_before: 'h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' +
'tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',
indent_after: 'h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' +
'tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',
whitespace_elements: 'p pre script noscript style textarea video audio iframe object code',
indent_before, indent_after - I removed the p element from that list and left all the default I have found in tinymce.js source file.
this stopped putting space before and after each p.
whitespace_elements - I added the p element to that list and left all the default I have found in tinymce.js source file. this stopped removing trainling spaces in the begining of P element
This seems very hard to do.
I'm pasting html code with <pre> into tinymce editor.
All the whitespaces are gone inside the <pre>
e.g. I'm trying to copy StackOverflow's <pre><code>block as in
def foo():
help me
It seems, tinymce trims whitespaces in <pre><code><span> and newlines are removed
How can I preserve it?
I'm using 3.5.3 btw
First of all you should set the entity encoding setting to raw
tinymce.init({
...
entity_encoding: "raw",
...ยด
But TinyMCE adds <br /> elements on line breaks if you edit your text. Here is a setup for syntay highlighting and preformatted text in NopCommerce, it is almost the same in WordPress or whatever.
TinyMCE Preformatted Text and Syntax Highlighting
I'm using tinyMCE to edit content from an existing website. This website has links in the format:
http://localhost/start.jsp%3Fparam=value
where the %3F is the escaped string for the question mark character. When TinyMCE edits a page containing one of these links, it converts the "%" sign into "%25" which breaks the link.
How can I disable tinyMCE's escaping of percent signs?
I have the following configuration set:
tinyMCE.init({
mode: "specific_textareas",
editor_encoding: "raw",
editor_selector: "tinyMCE",
relative_urls : false,
convert_urls : false
}
Note: I am using setContent to populate the initial value of the tinyMCE editor.
Should be:
entity_encoding: "raw"
instead of:
editor_encoding: "raw"
See http://tinymce.moxiecode.com/wiki.php/Configuration