Skip to content

Commit

Permalink
Bugfix: Can not select emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
Jocs committed Apr 1, 2018
1 parent 13f4164 commit efe58c7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Mark Text build for these platforms ![Conda](https://img.shields.io/conda/pn/con

| ![]( https://github.com/ryanoasis/nerd-fonts/wiki/screenshots/v1.0.x/mac-pass-sm.png) | ![]( https://github.com/ryanoasis/nerd-fonts/wiki/screenshots/v1.0.x/windows-pass-sm.png) | ![]( https://github.com/ryanoasis/nerd-fonts/wiki/screenshots/v1.0.x/linux-pass-sm.png) |
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| [latest version](https://github.com/marktext/marktext/releases/download/v0.8.12/marktext-0.8.12.dmg) | [latest version](https://github.com/marktext/marktext/releases/download/v0.8.12/marktext-setup-0.8.12.exe) | [latest version](https://github.com/marktext/marktext/releases/download/v0.8.12/marktext-0.8.12-x86_64.AppImage) |
| [latest version](https://github.com/marktext/marktext/releases/download/v0.9.25/marktext-0.9.25.dmg) | [latest version](https://github.com/marktext/marktext/releases/download/v0.9.25/marktext-setup-0.9.25.exe) | [latest version](https://github.com/marktext/marktext/releases/download/v0.9.25/marktext-0.9.25-x86_64.AppImage) |

Did not found your system ? Go the the [release page](https://github.com/marktext/marktext/releases). Still not found ? Shoot an [issue](https://github.com/marktext/marktext/issues).

Expand Down
10 changes: 0 additions & 10 deletions src/editor/contentState/copyCutCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ const copyCutCtrl = ContentState => {
})
}

// const mathText = $(`.${CLASS_OR_ID['AG_MATH']} span`)
// if (mathText.length > 0) {
// mathText.each((i, m) => {
// const ele = $(m)
// console.log(ele.text())

// ele.text(ele.text().replace(/\\/g, ''))
// })
// }

const codefense = $(`pre.${CLASS_OR_ID['AG_CODE_BLOCK']}`)
if (codefense.length > 0) {
codefense.each((i, cf) => {
Expand Down
1 change: 1 addition & 0 deletions src/editor/contentState/pasteCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const pasteCtrl = ContentState => {
}

const stateFragments = this.html2State(html)

if (stateFragments.length <= 0) return
// step 1: if select content, cut the content, and chop the block text into two part by the cursor.
const { start, end } = this.cursor
Expand Down
4 changes: 2 additions & 2 deletions src/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ class Aganippe {
const { left, top } = emojiNode.getBoundingClientRect()
const cb = item => {
setInlineEmoji(emojiNode, item, selection)
this.floatBox.hideIfNeeded(['emojis'])
this.floatBox.hideIfNeeded(['emoji'])
}
if (list.length) {
this.floatBox.showIfNeeded({
left, top
}, 'emoji', cb)
this.floatBox.setOptions(list)
} else {
this.floatBox.hideIfNeeded('emojis')
this.floatBox.hideIfNeeded('emoji')
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/editor/utils/importMarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ const importRegister = ContentState => {
}
// transform `paste's text/html data` to content state blocks.
ContentState.prototype.html2State = function (html) {
const markdown = turndownService.turndown(html)
// remove double `\\` in Math but I dont know why there are two '\' when paste. @jocs
const markdown = turndownService.turndown(html).replace(/(\\)\\/g, '$1')
return this.getStateFragment(markdown)
}

Expand Down

0 comments on commit efe58c7

Please sign in to comment.