Skip to content

[WIP]add link function#31

Open
narisada014 wants to merge 9 commits into
masterfrom
add_link
Open

[WIP]add link function#31
narisada014 wants to merge 9 commits into
masterfrom
add_link

Conversation

@narisada014

@narisada014 narisada014 commented Dec 4, 2018

Copy link
Copy Markdown
Contributor

追加したもの

  • セレクションを行なった後、リンクボタンを押すと、Link URLをインサートするためのポップアップが表示され、URLをセットすると選択範囲がアンカーに変化する
  • ポップアップがセレクションに追従して動くように変更
  • エディタ読み込み時に全てのaタグにaddEventListenerでホバー時のURLのポップアップ表示処理を追加する機能
  • アンカーを作成した後にaddEventListenerでホバー時のURLのポップアップ表示処理を追加する機能
  • URLのホバーをクリックするとLink URLをインサートするポップアップを表示

新たに追加したもの

  • 引用内にカーソルが存在する時のEnterを押した時の挙動の修正
  • ContentEditableの挙動でh2, h3タグに囲まれているテキストの末尾でEnterを押した時に挿入されるdivをpに変換する処理
  • pタグを消してそのpタグより上にあるノードとテキストを結合する際にContentEditableの挙動でspanが挿入される機能の回避処理の追加

まだ追加できていないもの

  • unlinkする機能
  • popupの選択がactiveになって入ればアイコンの色合いを変更する
  • popupがactive状態であればunlink, blockquoteの解除を行う機能
  • その他不必要になりそうな箇所の削除やリファクタリング

Comment thread src/AlisEditor.vue Outdated
}
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上記処理ですが、以下のような感じで書くのを検討してみてください!

    const targetNodeList = document.querySelectorAll('.target')
    targetNodeList.forEach(targetNode => {
      const anchorElements = targetNode.querySelectorAll('a')
      Array.from(anchorElements, anchorElement => {
        anchorElement.addEventListener('mouseover', this.addHoverEvent)
        anchorElement.addEventListener('mouseleave', this.deleteHover)
      })
    })

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@y-temp4 直します!ありがとうございます!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants