Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4078767
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'
,
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 18 2026, 04:27 (8 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ce/93/8053b46bfb12755ee4cf8d56e42e
Default Alt Text
editor.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment