Is it possible top have nested dropdown in image_list in insert/edit image plugin in Tinymce 5? - tinymce

In our old version of tinymce we used to have nested dropdown in image_list in insert/edit image plugin, see the attached image. But recently we migrated to tinymce 5.4.2 and since then it's not working.
Old code:
tinymce.init({
selector: 'textarea',
plugins: 'image',
menubar: 'insert',
toolbar: 'image',
image_list: [
{
title: "LearnCenter", menu: [{ title: 'Logo', value: 'Logo' }]
},
{
title: "UserAccount", menu: [{ title: 'Photo', value: 'Photo' }]
}
]
});
Above code is not working anymore so we made changes, see below code:
image_list: [{ title: 'Logo', value: 'Logo' },
{ title: 'Photo', value: 'Photo' }]
But after this code change, nest dropdown is gone. Is there any way by which we can have same functionality that we used to have. See the attached image for expected functionality.

This feature, using TinyMCE 4.x JSON structure, is set to return in TinyMCE 5.5, which, as of the time of posting this, is scheduled to be available later this month.

Related

Assign table_class_list as default - TinyMCE

I added two classes by table_class_list, but every time I create a table I have to open the advanced settings, choose the class, and save. Without that it doesn't use any class and is unformatted.
tinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'table',
toolbar: 'table',
table_class_list: [
{ title: 'None', value: '' },
{ title: 'No Borders', value: 'table_no_borders' },
{ title: 'Red borders', value: 'table_red_borders' },
{ title: 'Blue borders', value: 'table_blue_borders' },
{ title: 'Green borders', value: 'table_green_borders' }
]
});
I want the first class to always be selected by default, without me having to open the settings and hit save.

How to make sanity io array select as multiselect?

I have a lot of tags, and I need to select a lot for each document. It is uncomfortable to click one by one every time. Also I see selected elements. How can I remake it into somefield like a multiselect? It could be even native. Or how to select all tags at once?
I am using array:
{
title: 'Language',
name: 'language',
type: 'array',
options: {
layout: 'grid'
},
of: [{
type: 'reference',
title: 'Lang',
to: {
type: 'settingLanguages'
}
}],
},
Dropdown example (Add field to schema):
{
title: 'Genre',
name: 'genre',
type: 'string',
options: {
list: [
{ title: 'Sci-Fi', value: 'sci-fi' },
{ title: 'Western', value: 'western' },
],
},
},
This is currently not possible out of the box with the default array component, but you should be able to create an input like this by building a custom input for it with the behaviour you want.
More on how to build custom inputs: https://www.sanity.io/docs/extending/custom-input-widgets

Simply creating a toolbar in Ext JS

So I have a panel with a top and bottom toolbar that is created within the dockedItems config:
dockedItems: [
Ext.create('AM.view.TopToolbar',{}), // //This line alone breaks the app
{ //Toolbars
xtype: 'toolbar',
dock: 'bottom',
items: [
{ text: 'About', itemId: 'about' },
'-',
{ text: 'Legal', itemId: 'legal' },
...
The code works fine in FF, but breaks in IE9. I think it has to do with the syntax of my create statement, but I cannot find a solution on the forums.
Here's my TopToolbar class:
Ext.define('AM.view.TopToolbar', {
extend: 'Ext.toolbar.Toolbar',
alias: 'widget.toptoolbar',
defaults: { arrowCls: '' }, //Removing black arrow from toolbar items
items: [
{ text : 'Tools',
menu : {
items: [
//rest of my toolbar items and menus
All file structures are correct and working.
Namespace is 'AM'
Application breaks in Internet Explorer-have not tried in Chrome or Safari
I get this Error
: SCRIPT16389: Unspecified error.
ext-all.js, line 38 character 51878
Any ideas?
Cheers!

TinyMCE displaying html tags after saving and reloading the data

I'm having a bit of an issue with TinyMCE.
After saving the contents of the editor and redisplaying it all the HTML tags are visible.
This is how I'm initializing the editor:
tinyMCE.init({
setup: function (ed) {
ed.onSaveContent.add(function (ed, o) {
o.content = o.content.replace(/&#39/g, '&apos');
});
},
// General options
mode: 'specific_textareas',
theme: 'advanced',
encoding: 'xml',
entity_encoding: 'raw',
height: '500',
width: '100%',
plugins: 'autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave',
editor_selector: 'rich-text-area',
editor_deselector: 'text-area',
// Theme options
theme_advanced_buttons1: 'save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect',
theme_advanced_buttons2: 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor',
theme_advanced_buttons3: 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen',
theme_advanced_toolbar_location: 'top',
theme_advanced_toolbar_align: 'left',
theme_advanced_statusbar_location: 'bottom',
theme_advanced_resizing: false,
// Example content CSS (should be your site CSS)
content_css: 'css/content.css',
// Drop lists for link/image/media/template dialogs
template_external_list_url: 'lists/template_list.js',
external_link_list_url: 'lists/link_list.js',
external_image_list_url: 'lists/image_list.js',
media_external_list_url: 'lists/media_list.js',
// Style formats
style_formats: [
{ title: 'Bold text', inline: 'b' },
{ title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },
{ title: 'Red header', block: 'h1', styles: { color: '#ff0000'} },
{ title: 'Example 1', inline: 'span', classes: 'example1' },
{ title: 'Example 2', inline: 'span', classes: 'example2' },
{ title: 'Table styles' },
{ title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
]
});
The data after its redisplayed:
The data as it is stored in the database:
<p>Testing</p>
See http://www.tinymce.com/wiki.php/Configuration:encoding
Seems like you need to comment encoding: 'xml' on your configuration.
Add this under init function:
tinyMCE.init( {
forced_root_block: false, // Start tinyMCE without any paragraph tag
} )
you can remove Html tags with the help of #Html.Raw()
<p>we are Arrivaler web and Mobile development</p>
index view
#Html.Raw(var.description)
result:
we are Arrivaler web and Mobile development
There is a option by which we get raw data from database which is stored in the form of html tags.
html.raw is used for this purpose
In asp.net #html.raw(object) is the solution for this problem
Remember to decode the string that will be passed to tinyMCE.
Use html_entity_decode function in php.

TinyMCE image customization

How can I customize TinyMCE so that I'll be able to choose a css class for a specific image?
you can use the style_formats setting of tinymce to use the style plugin with classes of your own (using content_css setting too)
// Style formats
style_formats: [{
title: 'Styles'
}, {
title: 'Absatz 1',
block: 'p',
classes: 'absatz1',
exact: true
}, {
title: 'Absatz 2',
block: 'p',
classes: 'absatz2',
exact: true
},