comparison src/test/tiny.html @ 26:0837820b97fb

tinymce work
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 20 Jul 2022 15:47:18 -0600
parents fccbe5554fcc
children 6871eec2cf4c
comparison
equal deleted inserted replaced
25:66fd3784e60e 26:0837820b97fb
31 31
32 32
33 function tinymceSetup(editor) { 33 function tinymceSetup(editor) {
34 34
35 editor.ui.registry.addToggleButton('styleCode', { 35 editor.ui.registry.addToggleButton('styleCode', {
36 //text: 'code',
37 icon: 'sourcecode', 36 icon: 'sourcecode',
38 tooltip: 'Code', 37 tooltip: 'Code',
39 onAction: function(api) { 38 onAction: function(api) {
40 editor.execCommand('mceToggleFormat', false, 'code') 39 editor.execCommand('mceToggleFormat', false, 'code')
41 //api.setActive( !api.isActive() ); 40 //api.setActive( !api.isActive() );
55 'fontsize', 54 'fontsize',
56 'forecolor', 55 'forecolor',
57 ]) 56 ])
58 } 57 }
59 }); 58 });
59
60 editor.on( 'init', function(e) {editor.focus()} );
61 //editor.focus();
60 } 62 }
61 63
62 tinymce.init({ 64 tinymce.init({
63 selector: 'textarea', 65 selector: 'textarea',
64 setup: tinymceSetup, 66 setup: tinymceSetup,
67 menubar: false,
68 statusbar: false,
65 toolbar: 'link image media | styleCode bold italic underline strikethrough superscript styleText | blockquote numlist bullist', 69 toolbar: 'link image media | styleCode bold italic underline strikethrough superscript styleText | blockquote numlist bullist',
66 plugins: ['link', 'image', 'media', 'lists', 'code'], 70 //block_formats: 'Paragraph=div; Header 1=h1; Header 2=h2; Header 3=h3',
71 plugins: ['link', 'image', 'media', 'lists', 'code', 'autoresize'],
72 autoresize_bottom_margin: 0,
67 link_target_list: false, 73 link_target_list: false,
68 link_title: false, 74 link_title: false,
69 image_description: false, 75 image_description: false,
70 image_dimensions: false, 76 image_dimensions: false,
71 object_resizing: false, 77 object_resizing: false,
73 media_alt_source: false, 79 media_alt_source: false,
74 media_dimensions: false, 80 media_dimensions: false,
75 media_poster: false, 81 media_poster: false,
76 media_url_resolver: media_url_resolver, 82 media_url_resolver: media_url_resolver,
77 text_patterns: false, 83 text_patterns: false,
78 content_style: 'img {max-width: 500px;}', 84 content_style: 'img {max-width: 500px;} p {margin: 0}',
79 //newline_behavior: 'linebreak', 85 //newline_behavior: 'linebreak',
80 extended_valid_elements: 'b,i', 86 extended_valid_elements: 'b,i',
81 formats: { 87 formats: {
82 bold: { inline: 'b' }, 88 bold: { inline: 'b' },
83 italic: {inline: 'i'}, 89 italic: {inline: 'i'},