LLWiki正在建设中,欢迎加入我们

“User:Bhsd/edit.js”的版本间差异

跳转到导航 跳转到搜索
删除238字节 、​ 2020年11月28日 (六) 03:31
无编辑摘要
标签移动版网页编辑 移动版编辑
// 修改WikiEditor的替换文本框
if (['edit', 'submit'].includes( action ) && skin == 'vector') {
mw.loader.using( 'jquery.textSelection' ).then(() => {
$('body').on('click', 'input#wikieditor-toolbar-replace-replace', function() {
const ele = $( '<textareabody').on('click', id="'input#wikieditor-toolbar-replace-replace" tabindex="10">', function() {
$(this).keydownreplaceWith(e $( '<textarea id="wikieditor-toolbar-replace-replace" tabindex="10">' {)
if (e.keyCode == '13' .keydown(function(e) {
if (e.stopPropagation(keyCode == '13'); {
const text = ele e.valstopPropagation(),;
left = text.slice$(0, elethis).proptextSelection( 'selectionStartreplaceSelection', '\n' )),;
right = text.slice(ele.prop( 'selectionEnd' ));}
ele}).valkeypress(lefte +=> '\n' + right);{
if (e.keyCode == '13') { e.stopPropagation(); }
$(this }).replaceWith(ele );
});
$(this).replaceWith(ele);
});
}
if (e.keyCode == 9) {
e.preventDefault();
const text = $(this).valuetextSelection( 'replaceSelection', ' ' );
position = this.selectionStart,
left = text.slice(0, position),
right = text.slice( this.selectionEnd );
this.value = left + ' ' + right;
this.selectionStart = this.selectionEnd = position + 4;
}
});
16,874

个编辑

导航菜单