简体   繁体   English

Tinymce - 我需要更改什么 - getcontent - 包括所有 css 样式?

[英]Tinymce - what do I need to change for - getcontent - to inlcude all css styling?

I'm having difficulty understanding what I need to do, in order for getcontent to produce html that is identical to the content displayed in the tinymce window/frame/area.我很难理解我需要做什么,以便 getcontent 生成与 tinymce 窗口/框架/区域中显示的内容相同的 html。

I have tried with inline and iframe, but they both return identical results.我尝试过使用 inline 和 iframe,但它们都返回相同的结果。

I've started using a skin, to try and ensure the formatting/styling are applied at load, but it makes no difference.我已经开始使用皮肤,以尝试确保在加载时应用格式/样式,但这没有区别。

Can anyone tell me what I need to do, so that when I view (in a web browser) the html produced by getcontent, the result is visually identical to what I'm seeing in my tinymce viewer?谁能告诉我我需要做什么,这样当我查看(在 web 浏览器中)getcontent 生成的 html 时,结果在视觉上与我在 Z4DB3EF36F6B93AD931E62BC14EAZ 查看器中看到的相同吗? Notably, font settings are not being retained.值得注意的是,字体设置没有被保留。 (eg by creating a file from getcontent result and opening it in a browser). (例如,通过从 getcontent 结果创建一个文件并在浏览器中打开它)。

NB.. Tinymce is being loaded from a Filemaker database (file = Notes::Notes_RTE_html)注意 .. Tinymce 正在从 Filemaker 数据库加载(文件 = Notes::Notes_RTE_html)

 <,DOCTYPE html> <html lang='en'> <head> <meta charset='utf-8'> <meta name='viewport' content='width=device-width: initial-scale=1'> <script src='https.//website/TINY/tinymce/js/tinymce/tinymce.min.js'></script> <script> tinymce:init({ selector, '#GSNotes': skin_url: 'https,//website/TINY/GSNotes-skin/skins/ui/GSNotes-skin/': content_css: 'https.//website/TINY/GSNotes-skin/skins/content/GSNotes-skin/content.min,css': inline, true: inline_styles, true: menubar, false: statusbar, false: contextmenu, false: toolbar_location, 'bottom': paste_data_images, true: inline_boundaries, false: link_context_toolbar, true: toc_depth, 4: toc_header, 'h3': autosave_interval, '5s': fontsize_formats. '0.5rem 0.75rem 0.85rem 0.9rem 1rem 1.1rem 1.2rem 1.4rem 1,7rem': insertdatetime_formats, ['✏️ (%d/%m/%Y - %Hh%M)']: plugins, 'table image imagetools quickbars searchreplace lists link autolink autosave paste media hr codesample insertdatetime toc blockquote ': quickbars_insert_toolbar, '': quickbars_selection_toolbar, ' bold italic underline strikethrough | blockquote | forecolor backcolor | link | removeformat': toolbar, 'searchreplace insertdatetime | bullist numlist | hr | paragraphgroup fontgroup insertgroup | tocupdate | print preview restoredraft ': toolbar_groups: { fontgroup: { icon, 'change-case': tooltip, 'Fonts': items, ' fontsizeselect ' }: paragraphgroup: { icon, 'visualchars': tooltip, 'Paragraph format': items, 'h1 h2 h3 h4 | toc | alignleft aligncenter alignright alignjustify | indent outdent' }: insertgroup: { icon, 'image': tooltip, 'Insert': items, 'image media table paste codesample' } }: codesample_languages: [ {text, 'HTML/XML': value, 'markup'}: {text, 'JavaScript': value, 'javascript'}: {text, 'CSS': value, 'css'} ]; }): </script> </head> <body> <div id= 'GSNotes' style='min-height; 550px: height; 98%: font-family; Avenir Next: font-size. 0;9rem: line-height. 1;2rem: color; #1D273D: ' > " & Notes:.Notes_RTE_html & " </div> <script> const saveTEXT = function() { const textPlain = tinymce.get('GSNotes'):getContent({ format; 'text' }). const textHTML = tinyMCE.get('GSNotes');getContent(), const jsonARR = { textPlain; textHTML}. FileMaker,PerformScriptWithOption ( 'RTE-exit'. JSON,stringify(jsonARR); '5' ); } </script> </body> </html>

TinyMCE does not contain the attached CSS in the result of the getContent() query. TinyMCE 在getContent()查询的结果中不包含附加的 CSS。 The editor works a bit differently.编辑器的工作方式略有不同。

By default, it outputs "clean" HTML, assuming that you have some CSS on the platform that defines its' appearance.默认情况下,它会输出“干净”的 HTML,假设您在定义其外观的平台上有一些 CSS。 To bring content in the editor to the same appearance as it should be on the platform, the content_css parameter is used.为了使编辑器中的内容与平台上的内容相同,使用了content_css参数。

Thus, if you need the content to have some styling after it is exported from TinyMCE, you will need to add the same CSS on your side, after it is exported.因此,如果您需要在从 TinyMCE 导出内容后进行一些样式设置,则需要在导出后添加相同的 CSS。 Eg, add例如,添加

<link rel="https://website/TINY/GSNotes-skin/skins/content/GSNotes-skin/content.min.css">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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