Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1160472
plugin.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Sep 19, 7:11 AM
Size
1 KB
Mime Type
text/plain
Expires
Sun, Sep 21, 7:11 AM (2 h, 36 m)
Engine
blob
Format
Raw Data
Handle
750569
Attached To
rINP In-Portal
plugin.js
View Options
(
function
()
{
CKEDITOR
.
plugins
.
add
(
'my_document'
,
{
init
:
function
(
editor
)
{
var
pluginName
=
'my_document'
;
CKEDITOR
.
dialog
.
add
(
pluginName
,
this
.
path
+
'dialogs/document.js'
);
editor
.
addCommand
(
pluginName
,
new
CKEDITOR
.
dialogCommand
(
pluginName
));
editor
.
ui
.
addButton
(
'Document'
,
{
label
:
'Insert/Edit Document'
,
command
:
pluginName
,
icon
:
this
.
path
+
'images/document.png'
}
);
if
(
editor
.
addMenuItem
)
{
// A group menu is required
// order, as second parameter, is not required
editor
.
addMenuGroup
(
pluginName
);
// Create a manu item
editor
.
addMenuItem
(
'editDocument'
,
{
label
:
'Document Properties'
,
command
:
pluginName
,
icon
:
CKEDITOR
.
plugins
.
getPath
(
pluginName
)
+
'images/document.gif'
,
group
:
pluginName
}
);
}
if
(
editor
.
contextMenu
)
{
editor
.
contextMenu
.
addListener
(
function
(
element
,
selection
)
{
//function to be run when context menu is displayed
if
(
!
element
)
{
return
null
;
}
var
bInsideLink
=
(
element
.
is
(
'a'
)
||
element
.
hasAscendant
(
'a'
)
)
;
if
(
bInsideLink
||
editor
.
getCommand
(
'unlink'
).
state
!=
CKEDITOR
.
TRISTATE_DISABLED
)
{
// Go up to the anchor to test its properties
var
oLink
=
element
.
is
(
'a'
)
?
element
:
element
.
getParent
();
var
bIsAnchor
=
(
oLink
&&
oLink
.
getAttribute
(
'name'
)
&&
!
oLink
.
getAttribute
(
'href'
)
)
;
// If it isn't a link then don't add the Link context menu
if
(
!
bIsAnchor
&&
bInsideLink
)
{
var
id
=
oLink
.
getAttribute
(
'id'
,
2
);
if
(
id
&&
id
.
match
(
/^Doc_+/
)
)
{
return
{
editDocument
:
CKEDITOR
.
TRISTATE_OFF
};
}
}
}
return
null
;
}
);
}
}
}
);
// some code here
}
)();
Event Timeline
Log In to Comment