“MediaWiki:Gadget-site-shared.js”的版本间差异

添加220字节 、​ 2021年3月5日 (五) 11:58
无编辑摘要
*/
if (['edit', 'submit'].includes( action ) && mw.config.get( 'wgIsProbablyEditable' )) {
// #editform可能会重建
$('#editform').on('click', 'span.mw-charinsert-item', function() {
mw.hook( 'wikipage.editform' ).add(function($form) {
const $this = $(this);
console.log('Hook: wikipage.editform, 开始添加快速插入功能');
$('#wpTextbox1').textSelection( 'encapsulateSelection', {
$form.find( '#editform.mw-editTools' ).on('click', 'span.mw-charinsert-item', function() {
pre: $this.data( 'mw-charinsert-start' ) || $this.data( 'start' ), // undefined也没关系
post:const $this.data( 'mw-charinsert-end' ) ||= $(this.data( 'end' );
$('#wpTextbox1').textSelection( 'encapsulateSelection', {
} );
pre: $this.data( 'mw-charinsert-start' ) || $this.data( 'start' ), // undefined也没关系
post: $this.data( 'mw-charinsert-end' ) || $this.data( 'end' )
const $this = $(this } );
} );
});
}
16,874

个编辑