-2

我想要 HTML 标记的按键绑定和工具栏控件。例如,我想将文本更改为超链接,我可以按 Ctrl+L,或者单击某个工具栏按钮来添加链接。有什么包吗?就像我们可以在不同的博客网站(如 blogger.com)中找到的内容

4

2 回答 2

-1

我如何使用 CTRL+J 建立链接。

您可以在不同的行中选择一个单词甚至多个单词(使用 CTRL+ALT+DOWN)

文件 -> 键盘映射...

'atom-text-editor':
  'ctrl-j': 'custom:wrap-with-a-tag'

文件 -> 初始化脚本...

# set multiLine to false to split selections into single line
wrapSelections = (editor, before, after, multiLine = true, cursorDown = true) ->
  cursorOffset = before.indexOf '$1'
  cursorOffset = before.length if cursorOffset < 0
  before = before.replace '$1', ''
  after ?= before

  editor.transact ->
    editor.splitSelectionsIntoLines() unless multiLine

    cursorPositions = for selection in editor.getSelections()
      cursorPosition = selection.getBufferRange().start.translate [0, cursorOffset]
      selection.insertText("#{before}#{selection.getText()}#{after}")
      cursorPosition

    for cursorPosition, i in cursorPositions
      if i == 0
        editor.setCursorBufferPosition cursorPosition
        editor.moveDown() unless cursorDown
      else
        editor.addCursorAtBufferPosition cursorPosition
        

atom.commands.add 'atom-text-editor', 'custom:wrap-with-a-tag', ->
  wrapSelections @getModel(), '<a href="#">', '</a>', false, true
于 2020-11-10T07:39:38.327 回答
-1

正如@Ganzorig autocomplete-html 所建议的那样,它将完成这项工作

于 2020-04-27T02:47:20.657 回答