How to reload format-box in CKEDitor 4 dynamically? - javascript

I want to populate the format-box in CKEditor toolbar dynamically (depending on what the user selects in another select box).
Is it possible to change the options of the format-combo box dynamically , without reloading the whole CKEditor ?

The shortest answer is: no. However...
The plugin responsible for this box is the format plugin. It gathers all the data during the init function called when editor is being initialized. If you want to have this thing dynamically populated, you need to change some logic of this plugin on your own.
You might be interested in onRender callback for rich combos which is used by the plugin to dynamically change the value of the combo. Another handful thing might be add() method of rich combo used by format plugin. I'm pretty sure you got to extend the richcombo plugin to remove items.
Good luck anyway!

Related

Getting specific content from TinyMCE editor

I have a plugin im building for wordpress that injects a shortcode with content inside it after the user selects options for that plugin. What im having trouble with is tinyMCE.get('content').getContent() this is called when a user wants to update those options but using this pulls everything thats in tinymce, I need it limited to the content inside the shortcode open and close tags. For example: after a user selects options of the plugin, a shortcode of [plugin]---HTML OPTIONS---[/plugin] will be created but when tinyMCE.get('content').getContent() is called I need it to grab everything inside of said plugin tags and nothing else like so: [plugin]---GET THIS CODE----[/plugin] any help would be grateful. Let me know if you need clarification on anything.
If I understand what you are attempting then what you are looking for is the
tinymce.dom.Selection class (doc)
More specifically:
// Sets some contents to the current selection in the editor
tinymce.activeEditor.selection.setContent('Some contents');
// Gets the current selection
alert(tinymce.activeEditor.selection.getContent());
You might take a look at code in some of the available plugins. The link plugin in particular works with text selections.

How to dynamically add values in jQuery selectbox plugin

I am currently using jquery-selectbox plugin 0.2.
I am unable to add values dynamically to the select box.
If I add dynamically the values are dispalyed, if I view the source code from browser, but it is not dispaying in ui.
I have read somewhere about $("select").selectbox('option', options) would do it, but I don't know what arguments to pass in it.
Probably you only need to regenerate the object with $("#select_box_id").selectbox();

JQuery facebook-like plugin to handle the add/remove of tags?

i am using the jquery-ui autocomplete feature with multiple values for tags,
The thing is that it doesn't provide the feature to handle the hidden values and display current values as buttons (with the delete button and more usability via keyboard),
I am looking for some plugin just like this one but that works with jquery and no need of mootols or prototype
Do you know if there is any?
If not i am thinking of implement it mysel, the hidden input and displaying a list with all the options i need, but some JQuery alternative to the plugin on the link will just do it for me
Well i found this one and this one and few more (not so similar to the mentioned in question) all in here (weird couldn't find them in google separately)

Making a tag suggestion using jQuery chosen plugin

I am using jquery chosen plugin https://github.com/harvesthq/chosen/ to make my select form fields pretty. Here is the demo page for chosen plugin https://github.com/harvesthq/chosen
I was thinking if it is possible to make tags like stackoverflow using chosen plugin because some of its feature looks alike. I am also like to know how do i use chosen with ajax to add tag suggestions.
I could use one of those jquery tags out there but i would like to know if i can do it using chosen so i don't need to add another script with my page.
Let me know if you need to know anything more.
All that you have to do is to modify the select box with an ajax request. Than use :
$("#form_field").trigger("list:updated");
to tell "chosen" that the list has been updated.
Yes, all of what you ask is possible. From my answer to "Is there a way to dynamically ajax add elements through jquery chosen plugin?":
Take a look at the neat Select2 plugin, which is based on Chosen itself and supports remote data sources (aka AJAX data) and infinite scrolling.
The koenpunt fork of chosen has the functionality you want. More info here

JqGrid add button to advanced search dialog

I'd like to add the ability to save a complex query built up in the advanced search dialog.
Saving the generated SQL is no problem, but I'm not sure how to add buttons to the advanced search query dialog to give users the options of saving / loading a query.
Any advice would be appreciated.
There is no way to do this directly using the jqGrid API. However, you could use one of the optional events such as afterShowSearch to define a function that will dynamically add such buttons.
I suggest using FireBug to help reverse-engineer exactly where to place the buttons.

Categories