ArtitalkJS / Artitalk

通过leancloud实现的可实时发布说说的js
https://artitalk.js.org
MIT License
326 stars 51 forks source link

加载更多,新元素插入位置错误 #108

Closed Flysky12138 closed 1 year ago

Flysky12138 commented 2 years ago

如果写的说说含有 ul 标签。按照源码将会出现问题 https://github.com/ArtitalkJS/Artitalk/blob/7135a6c82af0c4aa4ddc790c8e2f35c7c6c6cbc6/src/main.js#L1532-L1535

你可以改成这样

document.getElementById('maina').insertAdjacentHTML('beforeend', mid)
Flysky12138 commented 2 years ago

这应该是很容易发现的错误,居然没人提交 Issues

Flysky12138 commented 2 years ago

另外 Pjax 问题,这里给个我的使用方法。

<script>
  void (function () {
    function load() {
      document.getElementById('add-Artitalk-Style')?.remove()
      new Artitalk({
        appId: '',
        appKey: ''
      })
    }
    try {
      load()
    } catch (error) {
      const el = document.createElement('script')
      el.src = 'https://unpkg.com/artitalk'
      document.head.appendChild(el).addEventListener('load', load)
    }
  })()
</script>