Remove path in status bar in TinyMCE4 - path

I have just migrated from TinyMCE3 to TinyMCE4 and I wonder how to remove the path in the status bar. But I want to keep my status bar in order to have the resize functionnality.
With TinyMCE3 we can do it with:
tinymce.init({
...
theme_advanced_path : false
});
How can I have the same result with TinyMCE4?
Thanks

In TinyMCE 4 you can remove just the path in the statusbar by setting the configuration elementpath to false, like this:
tinymce.init({ elementpath: false });

This works for me:
.mce-path {/* CSS */
display: none !important;
}
EDIT:
In TinyMCE4, I don't think there is an official way to do it by passing a parameter to tinymce.init(); to disable the path. You can pass statusbar: false but that will hide the path AND the resize icon, unfortunately!
The answer I gave by using CSS, hides the path but the resize icon stays there. But make sure you have the statusbar: true in the tinymce.init();

tinymce.init({
statusbar : false,

The CSS approach works, but is usually applied globally to each editor in the page. The old option of TinyMCE 3 could be applied individually for different editors.
I wanted to keep this flexibility and found the following solution:
a) Define a CSS rule like .myMceNoPath .mce-path{display:none;}
b) For an editor instance which should provide a resize handle without path display, define the following options:
resize: "both",
init_instance_callback : function (ed) {
ed.getContainer().className += " myMceNoPath";
}
This dynamically adds a class to the editor element, enabling us to apply the CSS only to the editors specifically marked this way.

tinyMCE.init({
menubar:false,
statusbar: false,
//etc
})
From: Remove menu and status bars in TinyMCE 4

Unfortunately this feature is deprecated in TinyMCE 4. But you always can block this visually by CSS. It must look something like this:
.mce-path {
display: none;
}

I am using tinyMCE v5. And the following works.
In order to hide the Path, pass "elementpath": false in init object and "statusbar": false to hide the full status bar. If you hide the whole status bar then you will also lose your ability to increase or decrease the height.

One quick solution in TinyMCE 4 is to set the path element's opacity to transparent:
tinymce.init({
...
init_instance_callback: function (editor) {
$(editor.getContainer()).find(".mce-path").css("opacity", "0");
}
});
This should hide the path text without otherwise affecting the status bar. I've found that disabling the status bar's visibility through either the init() function or CSS display property also results in a floating word count and resize icon overlapping the scrollbar.
Credit to immo and others for pointing out the callback and CSS concepts. I like this particular (jQuery) solution because it's self-contained and applies only to its parent editor, though variations are possible.

Setting theme_advanced_statusbar_location to empty string worked for me.
tinyMCE.init({
theme_advanced_statusbar_location : "",
})

Mine is based on the opacity concept from Dustin Carr above:
For TinyMCE 4, I located skin.min.css, searched mce-path-item and right after display:inline-block, I added opacity:0. So it finally is something like display:inline-block;opacity:0; *display...
It's just a quick trick, as Carr says: the element is still there when I click on it, it's just the standard user don't see it.
Hope it helps some one...
EDIT:The same for mce-divider ;)

Thanks to #Dustin Carr for his answer.
I've extended his answer a little bit , that's what i did , it works fine for me and when user hover cursor over the area of the path it doesn't display cursor at all (with opacity 0 it displays cursor over the path and path remains clickable) .
tinymce.init({
...
init_instance_callback: function (editor) {
$(editor.getContainer()).find(".mce-path").css("visibility", "hidden");
},
});
HTH

Related

How to center align the text in Vaadin TextField

I read the CSS styling section (https://vaadin.com/docs/v14/flow/styling/styling-components) and it mentions that global CSS doesnt affect the 'INPUT" field in the shadow DOM, So styling has to be added to shdaow DOM, But unfortunately no where does it explicitly say HOW to add the styling to the shadow DOM. Note. im using mainly Flow pure java with a bit of CSS.
I tried retrieving the elementt from component then retrieving the shadowRoot, then from root, retrieve the 'input' element to add styling to it, unfortunately that didnt work, shadowroot was null (this code executed from the onAttach() method in the view class)
private void setTextAlignCenterForTextFields(TextField textField) {
//find the internal 'Input' and set the styling to text-align=center, unfortunately
// you cant do that with global css, since the 'input' element is in shadow root
textField.getElement()
.getShadowRoot()
.get()
.getChildren()
.filter( elem -> "INPUT".equalsIgnoreCase(elem.getTag()))
.forEach(inputElem -> inputElem.getStyle().set("text-align", "center"));
}
Any ideas would be appreciated. I'm using Vaadin version 14.5.1.
There's already a theme variant to align the text
centerTextField.addThemeVariants(TextFieldVariant.LUMO_ALIGN_CENTER);
see https://vaadin.com/components/vaadin-text-field/java-examples/theme-variants
As for how to attach CSS to shadow root, basically use themeFor, see https://vaadin.com/docs/v14/flow/styling/importing-style-sheets/#component-styles
You can use CSS to target the value part:
.textfieldClass::part(value) {
text-align: center;
}
This video explains styling CSS parts: https://youtu.be/Y0uxb4ga44Y

Change Specific Element Resize Options in jQuery Resize

I am using the jQueryUI resizable widget, and have a bunch of resizable boxes on a page. When the document loads, I initialize the widget, like so:
$('.ui-draggable').resizable({
minHeight: 10, // 10 is actually the default
minWidth: 10, // 10 is actually the default
resize: function() {
showProperties(this);
},
});
However, at some point I want only some of those elements to change resize options. What I'm trying to do is this:
if (type == 'sometype')
{
console.log($('#'+elementID).resizable('option', 'handles'));
$('#'+elementID).resizable('option', 'handles', 'e,w');
console.log($('#'+elementID).resizable('option', 'handles'));
}
This indeed outputs:
e,s,se
e,w
in the console, so the event is triggered and the selector is correct, but the code doesn't actually work: in fact, the handles remain the same, namely e, s, se.
Is this because I'm using a different selector from the original init? If so, how can I change the resize options only on a subset of originally-resizable elements? And if not, what could be the problem?
Handles are actually divs added to the element on which resizable is applied. It seems that changing the option doesn't refresh these handles. Maybe there's a way to apply the changes on specific subset and refresh, but I'm not sure how.
But one quick workaround would be to hide the handles you don't want instead of changing the handle option. You would have to set handle option to all the handles you'll need, and then hide those not wanted. Like this to remove se handle for example:
$('#'+elementID).find('.ui-resizable-se').hide();

How to make the header transparent and show underneath when it's hidden

I am toggling the header visibility and when I hide it, I need it to be transparent and show the scrolling content.
I tried several ways but the header is not transparent. Please note it's hidden correctly but it left a white background instead. So I wanted to make it transparent:
$('.ui-header').hide().animate({opacity: 0.0});// Hide the header but its opacity doesn't get to 0
$(".ui-header").css("backgroundColor", "transparent");// No effect
How to make the header transparent so it will show the content underneath?
$(".ui-header").hide();
Should be sufficient. Hiding the element means not showing it, which is equivalent to setting the opacity of the element to zero.
When reading the documentation for the jQuery function .hide(), it clearly states that .hide() without any parameters is the equivalent to display: none; in CSS.
If you can't find the error with JS, I suggest giving display: none; to the ui-header class in CSS. If neither works we need more code to track down the error and give you a proper answer.
Edit: A JSFiddle demo available here.

jQuery UI Touch Punch set left css?

I want to use the jQuery Touch Punch plugin to do the following effect:
I have a Div which is only shown a little bit on the left side of my iPad screen. Now I want to use jQuery Touch Punch to pull it out. I can't seem to find how to restrain the properties, so I can write something like:
left-keyframe1: 0;
left-keyframe2: -48%;
I hope you get the idea. Also, when I pull out I want it to animate back when you didn't pull it out over 50%. Is there some documentation about this? I can't seem to find this. I looked through all examples on this site:
http://touchpunch.furf.com/
Thanks in advance!
I have found the solution:
$('.your-div').draggable(
{
scroll: false,
start:function(){$startpos = $(this).position();$(this).css({'transition':'0','-webkit-transition':'0'});},
stop:function(){
$position = $(this).position();
if($position.left > $startpos.left)
{
$(this).animate({'left':'0'});
}
else
{
$(this).animate({'left':'-52%'});
}
$(this).css({'transition':'youramounts','-webkit-transition':'youramounts'});
},
axis:'x'
});
Note: I added transition:0, because I had two eventtriggers and transition is conflicting with the dragfunction. The click and the drag. So on click I changed the css and did an animation via transition. If you do not have "transition" on your element, you don't need to include this.

Making ui datepicker header collapsible

I am trying to take the ui-datepicker-header and convert it to an accordion. It actually works (sort of). I want to hide notes here for the user to reveal if they choose.
I need the accordion to be collapsed when the page opens. What I have always open expanded despite using these parameters:
$('.ui-datepicker-header').accordion({
active: false,
collapsible: true,
autoHeight: false,
event: "click"
});
Once the page renders I see the arrow image is correct but I need click the header twice to get it to close. After this it works as expected.
Here's a fiddle demo: http://jsfiddle.net/mv5492/PuWWS/17/
Since these are both ui components I figured this would work fine.
Thanks in advance!
Mike
Move the $('.ui-datepicker-header').accordion(... declaration below the $('.ui-datepicker-header').append() statement that appends the text to the header.
This means that the aria- tags will be applied to the text under .ui-datepicker-header, and the text will be set to display: none when the page loads.

Resources