Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4018407
editor.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
editor.js
View Options
/*!
* VisualEditor rebaser demo
*
* @copyright See AUTHORS.txt
*/
(
function
()
{
function
RebaserTarget
()
{
RebaserTarget
.
super
.
apply
(
this
,
arguments
);
// HACK: Disable redo command until supported (T185706)
ve
.
ui
.
commandRegistry
.
unregister
(
'redo'
);
}
OO
.
inheritClass
(
RebaserTarget
,
ve
.
init
.
sa
.
Target
);
const
linkIndex
=
RebaserTarget
.
static
.
toolbarGroups
.
findIndex
(
(
group
)
=>
group
.
name
===
'link'
);
RebaserTarget
.
static
.
toolbarGroups
=
ve
.
copy
(
RebaserTarget
.
static
.
toolbarGroups
);
RebaserTarget
.
static
.
toolbarGroups
.
splice
(
linkIndex
+
1
,
0
,
{
name
:
'commentAnnotation'
,
include
:
[
'commentAnnotation'
]
}
);
RebaserTarget
.
static
.
toolbarGroups
.
push
(
{
name
:
'authorList'
,
align
:
'after'
,
excludeFromTargetWidget
:
true
,
include
:
[
'authorList'
]
}
);
new
ve
.
init
.
sa
.
Platform
(
ve
.
messagePaths
).
initialize
().
then
(
()
=>
{
const
progressDeferred
=
ve
.
createDeferred
(),
panel
=
new
OO
.
ui
.
PanelLayout
(
{
// eslint-disable-next-line no-jquery/no-global-selector
$element
:
$
(
'.ve-demo-editor'
),
expanded
:
false
,
framed
:
true
}
),
target
=
new
RebaserTarget
();
panel
.
$element
.
append
(
target
.
$element
);
// Add a dummy surface while the doc is loading
const
dummySurface
=
target
.
addSurface
(
ve
.
dm
.
converter
.
getModelFromDom
(
ve
.
createDocumentFromHtml
(
''
)
)
);
dummySurface
.
setReadOnly
(
true
);
// TODO: Create the correct model surface type (ve.ui.Surface#createModel)
const
surfaceModel
=
new
ve
.
dm
.
Surface
(
ve
.
dm
.
converter
.
getModelFromDom
(
ve
.
createDocumentFromHtml
(
''
)
)
);
surfaceModel
.
createSynchronizer
(
ve
.
docName
);
dummySurface
.
createProgress
(
progressDeferred
.
promise
(),
ve
.
msg
(
'visualeditor-rebase-client-connecting'
),
true
);
surfaceModel
.
synchronizer
.
once
(
'initDoc'
,
(
error
)
=>
{
progressDeferred
.
resolve
();
target
.
clearSurfaces
();
if
(
error
)
{
OO
.
ui
.
alert
(
$
(
'<p>'
).
append
(
ve
.
htmlMsg
(
'visualeditor-rebase-corrupted-document-error'
,
$
(
'<pre>'
).
text
(
error
.
stack
)
)
),
{
title
:
ve
.
msg
(
'visualeditor-rebase-corrupted-document-title'
),
size
:
'large'
}
).
then
(
()
=>
{
// TODO: Go back to landing page?
}
);
return
;
}
// Don't add the surface until the history has been applied
target
.
addSurface
(
surfaceModel
);
target
.
getSurface
().
getView
().
focus
();
}
);
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 14 2026, 16:01 (14 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4f/27/c2b9d7cc42ae2c4620e2cdea8afa
Default Alt Text
editor.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment