how to localize and and or in jqgrid advanced search window - jqgrid

By clicking search button in toolbar, advanced search window is opened.
In first row it contains combobox with selections AND and OR
How to replace those words with words in other language in this window ?

The problem with localization is the bug in the lines where jqFilter method will be called by searchGrid method. The method jqFilter supports groupOps option which are already set in many localization files grid.locale-XX.js, but the jqFilter method will be called without setting of the option.
To fix the problem one should just add
groupOps: p.groupOps,
to the list of options used in the call of jqFilter method. You can search for the text ).jqFilter({ in the jquery.jqGrid.src.js or in the jquery.jqGrid.min.js to find the corresponding place. In jquery.jqGrid.min.js of jqGrid 4.3.1 the p is renamed to f so one have to use groupOps:f.groupOps.
How you can see on the demo the grouping operation in the Advanced Searching dialog will be localized after applying the fix:
If your localized version of grid.locale-XX.js don't contains the texts for AND and OR operation you can set there manually
$.jgrid.search.groupOps = [
{op: "My And", text: "my AND operation"},
{op: "My Or", text: "my OR operation"}
];
see the next demo:
Without the described bug fix you can follow my suggestion from the answer on the close question.
UPDATED: I posted the corresponding bug report to trirand. I hope that the fix will be included in the main code of jqGrid.
UPDATED 2: The bug fix is already included in the main code of the jqgrid (see here).

Related

How can I disable a custom toolbar button in CKEditor 5?

I implemented a version of the image insert Simple Plugin example from CKEditor 5's framework docs.
But the example doesn't cover how to disable the item when the editor's isReadOnly property is set (like it does by default for all the standard buttons). I found docs for an isEnabled prop as well as a bind method for ButtonView, but it quotes examples using a command item, rather than a view item. Problem is, the Simple Plugin example doesn't create a command to bind to.
So question is whether I need to create a command, or if there is some other way to make the view item's state sensitive to the readonly state of the editor instance.
Thanks, and my apologies if I've left out any needed context (new to posting here on SO). Feedback is welcome (and I know y'all will whip me into shape).
D'oh, I think I figured it out:
view.bind('isEnabled').to(editor, 'isReadOnly', isReadOnly => !isReadOnly);
Just needed to bind to the observable property of the editor. Seems to be working as I desired/expected.

Xcode: How to find something only in specific file type?

In Android Studio, I could search something in certain file type using the File mask as shown below. e.g. I could search on Kotlin (*.kt) files only
In Xcode, is it possible to do so as well? E.g. I would like to search only on the Swift file (*.swift). I don't see any filter as shown below, other than Ignore/Matching Case
Below the search field, there's an icon with three dots and a line above and below. In the default case, "In Workspace" is printed next to it.
Click this icon/text and a list of scopes is shown. Click the "+ New Scopeā€¦".
You can define complex rules for your scope, but in your case you would just need one: select File extension in the attribute field, is equal to in the condition field and swift in the value field.
You can give your scope a name and save it if you need it often.
But there is also a second solution: just do your search. At the very bottom of the search panel you see a circle icon with three lines, similar to the "ground" symbol used in electrics (IMHO); next to it is a text field with placeholder "Filter". Enter *.swift here to filter the search results for hits in Swift files.
An alternative way and arguably quicker way to do it is to just type the extension in the filter section below the list of matches.

Hyperlink in an Xcode Comment

I am adding a hyperlink into the comments for my code for future reference. The hyperlink is being added by copying the url from Safari and then pasting it into Xcode.
The problem is that I can't control the hyperlink now that it has been pasted into my code and it is being modified when additional text is added.
Example URL: https://link.to.resource/DID/
How I want the link to be displayed: Device ID (listed in https://link.to.resource/DID/.)
How can I add the additional text without modifying the link location? When I add ./ to the end, it becomes part of the link and the address no longer works.
The simplest solution is to include a space or closing paren at the end of the link.
You can also use comment markup to add a link to Xcode's Quick Help Documentation.
/// Device ID (listed [here](https://link.to.resource/DID/))
This will create a quick help description that looks like this:
If you are really set on a period at the end of the link, you can add it inside the [] at the end of the link text. This is what Apple does in one of their examples for link markup. This adds a period at the end, but the period is styled as part of the link text.
/*:
For more information, see [The Swift Programming Language.](http://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/)
*/
Apple's Link Markup Documentation: https://developer.apple.com/library/content/documentation/Xcode/Reference/xcode_markup_formatting_ref/Links.html#//apple_ref/doc/uid/TP40016497-CH18-SW1

CKEditor format tags and a custom <small> tag

Is there a way to add a tag to the format dropdown that would wrap the text in <small></small> tags?
Editing config.js as follows causes a runtime error:
config.format_tags = 'small;p;h1;h2;h3;pre';
probably because <small> is not block level?
The reason of the runtime error is, that js can not find CKEDITOR.config.format_small.
You have to do two things:
Search for CKEDITOR.config.format_h6 in ckeditor.js and add CKEDITOR.config.format_small={element:"small"};. Then the error is gone, but you can not see the entry yet.
open the languagefile you want (e.g. en.js) and add "tag_small":"small text".
now CKEditor supports the small tag.
This works for me, I hope it works for you too.
If I want to add a custom section tag to format tags, this work for me:
1. Go to config.js, add
config.format_tags = 'h1;h2;h3;h4;h5;h6;section';
config.format_section = { element : 'section' };
2. Then open the languagefile you want (e.g. en.js) -> lang/en.js
search for "tag_pre":"Formatted", and add "tag_section":"Section".
If you're looking to wrap text in a certain tag, you can also achieve this with the Style dropdown as well.
First, configure your editor to allow styles at /admin/config/content/formats/manage/full_html. Replace full_html with whatever editor version you want to modify
Drag the Styles button to the active toolbar if it isn't already there
Add items to "Styles Dropdown" tab under CKEditor plugin settings
Each option takes the form css_selector | Human Visible Name so in your case, you'd add small.my_element_class | Super Special Small or something similar.
Instructions abbreviated from this post: https://www.axelerant.com/resources/team-blog/drupal-8-custom-styles-in-ckeditor

Ckeditor's Link Dialog incomplete?

In an Xpage running on Domino 9.0.1 I'm using a rich text control with some custom toolbar configuration using the control's "attr" property as it is described here: https://frostillic.us/f.nsf/posts/quick-and-dirty-ckeditor-toolbar-setup-for-xpages
I added the link toolbar template using
<xp:this.attrs>
<xp:attr name="toolbar">
<xp:this.value><![CDATA[[["Link", "Unlink", "Anchor"]]]]></xp:this.value>
</xp:attr>
</xp:this.attrs>
All three buttons are displayed fine, esp. I'm able to define an anchor link target.
But trying to reference the anchor target I find that the Link dialog is somewhat incomplete as I can't define my link to use a relative target on the same page. I tried entering a reference in the dialog's URL field as #myAnchorId, but that results in a link looking like this:
....
Here's an image of the dialog that pops up from my Xpage when I hit the "URL link" button:
And this is what the dialog looks like that I can test from the CKEditor Samples page:
I'm aware that the samples page uses CKEditor V 4, so the dialog is somewhat different, but even V 3.6 should be able to reference anchor links using the dialog.
I already looked up on the installed ckeditor's version; \DominoData\domino\html\ckeditor\version.txt says:
cke_version=3.6.6.2
cke_revision=20130606-1534
Question is: what's missing here? Do I have to somehow modify the dialog?
Oh my, finally got it to work; #IBM: this feature truly could use some proper documentation! I'll mark this answer as a community wiki.
Indeed a different dialog is used here, which btw appears to apply to all the dialogs in use with Domino's CKEditor implementation. The trick in my case is to use one of the custom toolbar items instead of the standard one; up to now I found three of those customized items:
use MenuLink instead of the standard Link item; this item
consists of two sub items ('URL Link' and 'Anchor Link'), each calling its own dialog version; the resulting toolbar definition then looks like this: ['MenuLink', 'Unlink', 'Anchor']
use MenuPaste instead of the standard Paste item; again, this
item consists of two sub items ('Paste' and 'Paste as text'), again
each calling its own dialog version
use LotusSpellChecker to add IBM's own spell checking feature, where CKE's standard spell checker isn't working
I found hints to those three custom items inside my local \DominoData\domino\html\ckeditor\config.js. Don't know if those are all custom items available to day.
EDIT:
IBM's Domino Designer Xpages User Guide mentions another means of customizing the toolbar; the section unfortunately is incorrect in describing the options for the toolbarType attribute: be aware that all named types must start with capital letters, e.g. Basic, Slim, Medium, Large, Full, while the also mentioned Lite type isn't working at all; mistyping or using a non-existing value results in the editor not being displayed at all.
The link dialog that you're using is not the default one, so you should check how to modify it or replace it with the default one.

Resources