From: Yury K. <kat...@gm...> - 2012-05-23 15:57:25
|
Hi Leonard! Thanks for your advice! I managed to remove a table button with this code: var customizeToolbar = function() { $( '#wpTextbox1, .wikieditor' ).wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'insert', 'tool': 'table' } ); }; /* Check if we are in edit mode and the required modules are available and then customize the toolbar */ if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit', 'formedit'] ) !== -1 ) { mw.loader.using( 'ext.wikiEditor.toolbar', function () { $(document).ready( customizeToolbar ); } ); } However after I have added this to Common.js I saw that my two wikieditor boxes become glued together. Here is a live demo: http://chistovik.wikivote.ru/index.php?title=CliWare&action=formedit Could you please show me your code for adding/removing elements that do not have this side-effect? ----- Yury Katkov On Wed, May 23, 2012 at 2:16 AM, Leonard Wallentin < leo...@ho...> wrote: > >Hi everyone! Thank for WikiEditor support in Semantic Forms, it works > really cool. > > > >I have a question on customization WikiEditor: I need to remove some > sections and add some buttons to it. Traditionally I would go to [1] and > follow the instructions, but in Semantic Forms there are some problems: > >1) I need to add the customiztion code inside the function that check > whether or not I'm in form edit mode. How to do that? > >2) I cannot pick $( '#wpTextbox1') element and run wikiEditor from it since > there is no such element. There are multiple spans and each of them may > have WikiEditor in it. So I tried picking $('.wikiEditor-ui').parent() but > had not much success: no modifications are applied. What should I pick? > > > >I would be very grateful if someone show me an example of the > customization. > > > > For me this works (for customizing both formedit and edit modes): > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > var customizeToolbar = function() { $('.wikieditor, > #wpTextbox1').wikiEditor('addToToolbar', { > /* Your WikiEditor code goes here */ > > }); }; /* Check if we are in edit mode and the required modules are > available and then customize the toolbar */ if ( $.inArray( mw.config.get( > 'wgAction' ), ['edit', 'submit', 'formedit'] ) !== -1 ) { mw.loader.using( > 'ext.wikiEditor.toolbar', function () { $(document).ready( customizeToolbar > ); } ); } > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > In other words: $('.wikieditor') instead of $('#wpTextbox1'), and check > mw.config.get( 'wgAction' ) for the value 'formedit' to check for edit mode. > > Leo > [1] > http://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization > Cheers, > > > ----- > Yury Katkov > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference Exclusive live event will cover all the > ways today's security and threat landscape has changed and how IT managers > can respond. Discussions will include endpoint security, mobile security > and the latest in malware threats. > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ Semediawiki-devel mailing > list Sem...@li... > https://lists.sourceforge.net/lists/listinfo/semediawiki-devel > |