I'm new with TinyMCE and trying to set the size of some of the buttons in the editor to small and some others' to medium, in TinyMCE 4.
I know about this property toolbar_items_size but this sets all the button's size small or medium. Instead, I'm trying to set the size property of the buttons in editor.buttons[] manually after the buttons get registered with the editor but before the theme gets initialized since the theme uses Factory.create() to create buttons & that sets class btn-<size> to the button, which sets its size.
I've looked into TinyMCE's code too but have not able to figure out a way to do so. Also, I've observed that all the editor's events get fired after the theme gets initialized, like BeforeSetContent,..etc.
I'm using modern theme.
Is there some way to achieve this?
Thanks.
TinyMCE simply does not support what you are trying to do - the buttons on the toolbar(s) are a uniform size. You can pick that uniform size (as you reference) but you can't mix buttons of different sizes on the toolbar.
Related
Background: we have TinyMCE React inside a few contexts where the parent element is manually resized by the user (resizable modal dialog, etc.) and we want the TinyMCE component to resize appropriately. In older versions, we did this using the resizeTo functionality documented here. However, that no longer seems to be available after the upgrade.
My previous attempt to resolve this involved using a key based on concatenating the width and height of the editor with a debounce while it was resizing. Basically, whenever the size changed by enough, I tore down the old component and rendered a new one whose config options included the new size. While this is largely effective, it causes an issue where, when you attempt to edit the field after resizing, it flickers and loses focus initially.
Unfortunately, we are using pixel-based size calculations, so specifying the height in percentages instead of pixels won't work.
What is the new official way to do this? Ideally, there would be some new version of editor.theme.resizeTo that we could use instead and dispatch with the key-based solution entirely, but I was unable to find it in any of the documentation.
Just wrap the editor in a div which has the calculated height and width, and then set the editor to height and width of 100%.
I've been searching around (both on SO and around the web) to try to figure out how I can get the current height of the editor after the user has resized it. The TinyMCE 4.x docs don't show any kind of resizing event. When searching around I did come across the ResizeEditor event but that seems to apply only when objects within the editor are resized (which makes it seem like a poorly named event). Despite that, I tried to listen to the ResizeEditor event just to see and it does appear to fire whenever I resize the editor (though, I'm unsure if that's because the actual editor is resizing or because elements within the editor are getting resized, too. In any case, only the event object is passed in as an argument to the listener and I don't see any way to get the editor's current height (after the resize) from that event.
So, is there a way I can do this? To listen to the editor being resized and get its height?
thnx,
Christoph
You should be able to get the entire height of the editor (Menus, Toolbars, StatusBar, content area, etc) with code like this:
tinyMCE.activeEditor.getContainer().clientHeight
tinyMCE.activeEditor.getContainer().clientWidth
When you call tinyMCE.activeEditor.getContainer() you are getting the outermost div that contains all that makes up TinyMCE. From there it is just standard JavaScript to get the relevant dimensions of that element.
Here is an example: http://fiddle.tinymce.com/qigaab/18
In my application the users can create a list of names associated with icons and colours. I've got the data stored in a GtkListStore and displayed using a GtkTreeView. The colour column is a GtkCellRendererText with the background-rgba property holding an opaque colour selected by the user. It looks like this.
However as you can see the selection bar hides the currently selected colour. The colour definition I've used in the CSS is alpha(#cce8ff, 0.5) and I know that the alpha is working because the colour fades out when I decrease the alpha value.
What I want is for the background colour in the cell to be visible through the selection highlight, although I could also live with the background colour blocking the selection highlight in that cell as long as the selected row was still clearly identified.
Is there some incantation I can use to achieve this? Or is this a bug in GTK3?
I'm using GTK 3.24.1 on Fedora 29. The application is written in Haskell using the gi-gtk binding.
I have a existing form where the resizing is disabled. I tried to change the property Border Style to bsSizeable and border icons to [biSystemMenu,biMinimize,biMaximize]. I am able to resize but the controls inside the form is not sized accordingly. Any help would be appreciated.
The border style and icons control whether the form is resizable, but the controls on a form don't automatically move unless you've configured them to do so. Change their Align, Anchors, or Constraints properties, which all affect the size and position differently. You can also handle the form's OnResize event and arrange the controls however you want.
I'm adding text area dynamically, which will be instance of tine mce. In a page, I will be adding text area for say heading, paragraph etc. For heading, I need to have only b,I,U and align buttons displayed, also for p, I need a different set of buttons.
Is it possible ?
How to do if possible ?
As far as i can see you want to have different instances of tinymce on a page.
All you need to do is to initialize each tinymce instance with an own configuration.
you can