維基百科討論:InPageEdit
新增話題外觀
由Dabao qian在話題在WikiEditor插件中使用站內現有編輯按鈕擴展上作出的最新留言:2 天前
next版可以把配置存檔到meta站,以供全域使用嗎?
[編輯]v2版可以存到meta的js頁,將配置應用到所有站台。next是個json,不知道怎麼全站配置😂--𝙵𝚘𝚛 𝙴𝚊𝚌𝚑 ... 𝙽𝚎𝚡𝚝 2025年12月7日 (日) 14:07 (UTC)
- @For Each ... Next:在meta global.js加入IPE-next安裝代碼之後再加入:
window.RLQ.push(() => { mw.hook('InPageEdit.ready').add(async (ipe) => { await ipe.preferences.setMany( // 本行以下插入ipe-prefs.json保存的内容,例子: { "pluginStore.registries": [ "https://cdn.jsdelivr.net/npm/ipe-plugin-zhwiki/dist/registry.v1.json" ], "quickEdit.editSummary": "𝑄𝑢𝑖𝑐𝑘 𝑒𝑑𝑖𝑡", "toolboxAlwaysShow": true } // json结束 ); console.log('[InPageEdit] 配置已应用'); }); });
- 當然,這樣會總是覆蓋本地的配置,如果需要可以自己寫一點合併邏輯,例子:
window.RLQ.push(() => { mw.hook('InPageEdit.ready').add(async (ipe) => { // 要全域应用的配置 const newConfig = { "pluginStore.registries": [ "https://cdn.jsdelivr.net/npm/ipe-plugin-zhwiki/dist/registry.v1.json" ], "quickEdit.editSummary": "𝑄𝑢𝑖𝑐𝑘 𝑒𝑑𝑖𝑡", "toolboxAlwaysShow": true }; // 获取本地配置 const currentConfig = await ipe.preferences.getAll(); // 合并 const mergedConfig = {}; for (const [key, newValue] of Object.entries(newConfig)) { const currentValue = currentConfig[key]; // 如果是数组,合并并去重 if (Array.isArray(newValue) && Array.isArray(currentValue)) { mergedConfig[key] = [...new Set([...currentValue, ...newValue])]; } else { // 其他类型使用全域配置 mergedConfig[key] = newValue; } } await ipe.preferences.setMany(mergedConfig); console.log('[InPageEdit] 配置已应用:', mergedConfig); }); });
- --PexEric 2025年12月12日 (五) 18:34 (UTC)
- 說實話挺麻煩了。目前配置導入導出好像是主要用來備份,不知道日後會不會加入自動讀取用戶頁配置的功能,我覺得大概率不會😂。--PexEric 2025年12月12日 (五) 18:34 (UTC)
- 感謝~ 感覺好高端,還是老版本做得比較好😂 𝙵𝚘𝚛 𝙴𝚊𝚌𝚑 ... 𝙽𝚎𝚡𝚝 2025年12月13日 (六) 03:41 (UTC)
在WikiEditor插件中使用站內現有編輯按鈕擴展
[編輯]在個人common.js加入以下內容即可:
(() => {
let ipe_qe_ready = false;
mw.hook('InPageEdit.ready').add((ctx) => {
ctx.on('quick-edit/wiki-page', ({ modal }) => {
if (ipe_qe_ready) {
return;
}
ipe_qe_ready = true;
const content = modal.$content;
const observer = new MutationObserver(async(mutations, obs) => {
const hasWikiEditorUI = $(content).find('.wikiEditor-ui').length > 0;
if (hasWikiEditorUI) {
obs.disconnect();
const editTools = ['Edittools-vector', 'Edittools-vplus', 'Edittools-vote', 'Edittools-delh'];
for (const name of editTools) {
if (+mw.user.options.get(`gadget-${name}`) === 1) {
await mw.loader.using(`ext.gadget.${name}`);
}
}
}
});
observer.observe(content, { childList: true, subtree: true });
});
});
})();
與原生傳統編輯器一樣,需要在「參數設置」—「小工具」中啟用對應按鈕擴展才能使用。--Dabao qian℡ 2026年11月23日 (一) 17:23 (UTC)