mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-30 19:15:43 +00:00
Table of contents is working now - fixed dependency issues and removed some globals that are no longer needed.
This commit is contained in:
parent
94c8be537b
commit
ff8e204ccd
|
@ -79,7 +79,11 @@ class WikiEditorHooks {
|
||||||
'scripts' => 'extensions/WikiEditor/modules/jquery.wikiEditor.toc.js',
|
'scripts' => 'extensions/WikiEditor/modules/jquery.wikiEditor.toc.js',
|
||||||
'styles' => 'extensions/WikiEditor/modules/jquery.wikiEditor.toc.css',
|
'styles' => 'extensions/WikiEditor/modules/jquery.wikiEditor.toc.css',
|
||||||
'dependencies' => array(
|
'dependencies' => array(
|
||||||
'jquery.wikiEditor', 'jquery.ui.draggable', 'jquery.ui.resizable'
|
'jquery.wikiEditor',
|
||||||
|
'jquery.ui.draggable',
|
||||||
|
'jquery.ui.resizable',
|
||||||
|
'jquery.autoEllipsis',
|
||||||
|
'jquery.color',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'jquery.wikiEditor.toolbar' => array(
|
'jquery.wikiEditor.toolbar' => array(
|
||||||
|
@ -548,11 +552,6 @@ class WikiEditorHooks {
|
||||||
'modules' => array(
|
'modules' => array(
|
||||||
'wikiEditor.toc',
|
'wikiEditor.toc',
|
||||||
),
|
),
|
||||||
'configurations' => array(
|
|
||||||
// These are probably only for testing purposes?
|
|
||||||
'wgNavigableTOCCollapseEnable',
|
|
||||||
'wgNavigableTOCResizable'
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,7 @@ fn: {
|
||||||
*/
|
*/
|
||||||
function buildList( structure ) {
|
function buildList( structure ) {
|
||||||
var list = $( '<ul />' );
|
var list = $( '<ul />' );
|
||||||
for ( i in structure ) {
|
for ( var i = 0; i < structure.length; i++ ) {
|
||||||
var div = $( '<div />' )
|
var div = $( '<div />' )
|
||||||
.addClass( 'section-' + structure[i].index )
|
.addClass( 'section-' + structure[i].index )
|
||||||
.data( 'index', structure[i].index )
|
.data( 'index', structure[i].index )
|
||||||
|
@ -641,7 +641,7 @@ fn: {
|
||||||
}
|
}
|
||||||
context.modules.toc.$toc.html( buildList( structure ) );
|
context.modules.toc.$toc.html( buildList( structure ) );
|
||||||
|
|
||||||
if ( wgNavigableTOCResizable && !context.$ui.data( 'resizableDone' ) ) {
|
if ( !context.$ui.data( 'resizableDone' ) ) {
|
||||||
buildResizeControls();
|
buildResizeControls();
|
||||||
buildCollapseControls();
|
buildCollapseControls();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
$( document ).ready( function() {
|
$( document ).ready( function() {
|
||||||
// Add table of contents module
|
// Add table of contents module
|
||||||
$( '#wpTextbox1' )
|
$( '#wpTextbox1' )
|
||||||
.wikiEditor( 'addModule', 'toc' )
|
.wikiEditor( 'addModule', 'toc' );
|
||||||
// FIXME - should move the ready handler code to the create function so this isn't necissary
|
// FIXME - should move the ready handler code to the create function so this isn't necissary
|
||||||
.data( 'wikiEditor-context' ).fn.trigger( 'ready' );
|
//.data( 'wikiEditor-context' ).fn.trigger( 'ready' );
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in a new issue