inpageedit-v2 icon indicating copy to clipboard operation
inpageedit-v2 copied to clipboard

[SUGGEST] 在讨论页底部添加“新增讨论串”按钮

Open dragon-fish opened this issue 4 years ago • 1 comments

你所提出的建议是由于哪个功能不尽人意吗/Is your feature request related to a problem?

在讨论页只能编辑已有讨论串或者编辑整个页面,新建讨论串很麻烦

你认为能够如何改善/Describe the solution you'd like

RT

预计实现方式

  • 判断页面是不是讨论页
!(function () {
  // ...
  var config = mw.config.get()
  const _msg = (args) => {
    // return `{${args}}`
    return '新增讨论串'
  }
  /**
   * 判断页面是不是讨论页
   * 按照mw的规范,讨论页的 NamespaceID 一定是奇数
   */
  if (config.wgNamespaceNumber % 2 !== 0) {
    console.log('Is talk page')
    $('#mw-content-text').append(
      $('<div>', { class: 'in-page-edit', style: 'text-align: center' }).append(
        $('<hr>'),
        $('<button>', { text: _msg('edit-add-new-section-btn'), class: 'btn btn-secondary' }).click(function () {
          // Do sth.
          mw.notify('开始编辑新讨论串啦耶耶耶~')
        })
      )
    )
  }
})()
  • 编辑器
    • quickEdit模块进行小修改,例如传参{section: 'new'}时,替换summary的功能和位置

补充说明/Additional context

建议由萌娘百科用户星海子提供

dragon-fish avatar Aug 19 '20 17:08 dragon-fish