How to remove some menu item from context menu for Ckeditor4? - ckeditor4.x

since the "Paste" is not work in browser, I would like to remove it from context menu, and keep other menu items, in CKeditor 4.73.
please advice, thanks

There is an api method on the editor instance for removing menu items. You can accomplish this by doing the following:
CKEDITOR.on('instanceReady', function (e) {
if (e.editor.contextMenu) {
e.editor.removeMenuItem('paste');
}
});

Related

Vuetify Combobox - open dropdown on icon click

I'm trying to create a search input field with a history of previous searches on a dropdown, like, for example the search field in the Intellij editor.
I'm new to Vuetify and from what I can see so far it looks like Combobox is the best component to use.
I would like the dropdown to only open if you click the dropdown icon. At the moment the dropdown opens when you click in the text input field. From the documentation is looks like prop :menu-props="{openOnClick: false}" might be what I need, but it doesn't seem to work.
Can anyone give me pointer in the right direction?
https://codepen.io/damianhelme/pen/zMXJvb
<v-combobox
v-model="search"
:items="searchHistory"
label="Search"
:menu-props="{openOnClick: false}"
></v-combobox>
new Vue({
el: '#app',
data () {
return {
search: '',
searchHistory: [
'Apple',
'Banana',
'Pear'
]
}
}
})
Thanks.
EDIT:
Updated pen with custom append slot to deal with icon state:
https://codepen.io/anon/pen/KrjzRL
If you want to open (and close) the combobox only on icon-click, try this trick:
<v-combobox
:menu-props="{value: autoselectMenu}"
#click:append="toggle"
></v-combobox>
Pass custom value to menu - this indicates whether menu should be opened/closed.
Then change that value only on icon-click by using :append-icon-cb prop.
data () {
return {
autoselectMenu: false,
// ...
methods: {
toggle() {
this.autoselectMenu = !this.autoselectMenu
}
// ...
So for any other case when you want to open or close the menu, just change that custom value i.e. autoselectMenu.
codepen

Auto-close menu sections on open

We would like to only have one menu section open at a time using mmenu and so does anyone know how we could automatically close any opened sections when a section is expanded?
Thanks
OK i managed to come up with this which works, there's probably a better way to do it:
$("#mm-0 a[href^=#]").click(function() {
var clickedMenu = $(this);
$("#mm-0 a[href^=#]").parent().each(function( i ) {
$(this).removeClass("mm-opened");
});
if($(clickedMenu).parent().hasClass("mm-opened")){
$(clickedMenu).parent().removeClass("mm-opened");
}else{
$(clickedMenu).parent().addClass("mm-opened");
}
});
So i basically add an onclick handler to any anchor links in the menu and then update the class.

How to access text of the selected Kendo menu item

I need to display the title of my page as the text of the menu item so how can I access the text of the selected menu item?
You can use the e.item field of the select menu event. Then use the text() jQuery method to get the text. The trick is to avoid getting the text of the child menu items. Here is how
$("#menu").kendoMenu({
select: function(e) {
var text = $(e.item)
.clone()
.find("ul")
.remove()
.end()
.text();
alert(text);
}
});
Here is a live demo: http://jsbin.com/amijud/1/edit
The easiest and best way is to use
e.item.firstChild.innerText

Kendo menu does not draw arrow icons for appended items

In order to add items to a kendo menu dynamically, here in the forums, the kendo team suggested to use the append method as described in this example to append submenus.
I've done this, now I have the problem of arrows not rendering for nodes. The issue can be seen in this example: http://jsfiddle.net/MMRCf/16/ if you hover on "Item 1" then click on "Sub Item 2", "Sub Item 2" will be populated with a submenu. This submenu lacks arrows for expanding nodes.
Perhaps this is a bug that needs reporting but I cannot post on Kendo menu forum.
Does anyone know how I could get arrow icons to render?
I think the append method is where a fix could be applied:
append: function (item, referenceItem) {
referenceItem = this.element.find(referenceItem);
var inserted = this._insert(item, referenceItem, referenceItem.length ? referenceItem.find("> .k-group, .k-animation-container > .k-group") : null);
each(inserted.items, function (idx) {
inserted.group.append(this);
var contents = inserted.contents[idx];
if (contents) {
$(this).append(contents);
}
updateArrow(this);
});
updateArrow(referenceItem);
updateFirstLast(inserted.group.find(".k-first, .k-last").add(inserted.items));
return this;
},
Actually seems the updateArrow function is broken. I've updated it for the next release, meanwhile you can also update it to get it working, from this:
item.find(".k-icon").remove();
to this:
item.find("> .k-link > .k-icon").remove();

How to disable contextmenu except in the grid of telerik FileExplorer?

I tried to disable unnecessary context menu when I set a grid with ContextMenus. By default, if you click the blank part of the grid, it disables the Delete menu.
However, after adding customized menu like Download, it shows in the context menu even there is no selected item (i.e., How can I download it?). So I want to disable the unnecessary menu or make it invisible except in the grid row context menu.
I'm using telerik ASP.NET AJAX contorl 2009 Q2.
Thanks in advance.
This piece of code should help - basically what you need to do is attach a handler to the menu showing event, check the target element (the element where you right-clicked) and if it is the grid area itself - disable the menu item.
<script type="text/javascript">
function OnClientLoad(explorer)
{
explorer.get_gridContextMenu().add_showing(disableItem);
}
function disableItem(sender, args)
{
var target = args.get_targetElement();
if (target && target.className == "rgDataDiv")
{
var dlItem = sender.findItemByValue("download");
dlItem.set_enabled(false);
}
}</script><telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" OnClientLoad="OnClientLoad"></telerik:RadFileExplorer>

Resources