Opened 13 years ago

Closed 12 years ago

#7828 closed defect (fixed)

dijit._editor._Plugin: custom plugins UI does not show up if they are meant to handle custom commands

Reported by: lipik Owned by: bill
Priority: high Milestone: 1.5
Component: Dijit Version: 1.2.0
Keywords: Cc:
Blocked By: Blocking:


I am creating a pluging to handle the save command - a button is displayed that would carry out some custom action (save editor content upon being clicked). However, the UI comes in hidden due to the following code in _Plugin.js:

if (!this.editor.queryCommandAvailable(this.command)) {
 // console.debug("hiding:", this.command);
 if(this.button){ = "none";

It should be changed to:

if (this.useDefaultCommand && !this.editor.queryCommandAvailable(this.command)) {
 // console.debug("hiding:", this.command);
 if(this.button){ = "none";

Change History (5)

comment:1 Changed 13 years ago by bill

I'm not sure what useDefaultCommand is for? There aren't any comments in the code. Can you explain what that parameter is for?

comment:2 Changed 13 years ago by bill

Milestone: tbd1.5

comment:3 Changed 13 years ago by liucougar

useDefaultCommand determines whether the function is provided by the native browser or not

so I think the suggested change should be made

comment:4 Changed 12 years ago by bill

Owner: set to bill
Status: newassigned

The current code and the 1.2 code actually checks for this.command.length to see if a command is defined, so I'm not sure where you copied that code from in the description above.

Still, the this.command.length check isn't sufficient because a plugin like TabIndent defines command but doesn't use the browser's native support to execute it. So I'll make the change.

comment:5 Changed 12 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [21691]) Fixing check for when to hide the plugin's button, although I'm doubtful that display:none on the button for a plugin that won't work is the right approach; for example it might mess up keyboard support in Toolbar. Fixes #7828 !strict.

Note: See TracTickets for help on using tickets.