Skip to content

Commit

Permalink
Merge branch 'ueberdosis:develop' into fixed-4137
Browse files Browse the repository at this point in the history
  • Loading branch information
hariacharya80 authored Jun 26, 2023
2 parents 7a014b1 + 75f0418 commit 38914d6
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 21 deletions.
11 changes: 11 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Global
* @bdbch @svenadlung

# docs
/docs/ @svenadlung

# demos
/demos/ @bdbch

# LICENSE
LICENSE.md @philipisik
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:

- name: Test ${{ matrix.test-spec.name }}
id: cypress
uses: cypress-io/github-action@v5.6.1
uses: cypress-io/github-action@v5.8.3
with:
cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
start: npm run start
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/stale.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,8 @@
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}
21 changes: 21 additions & 0 deletions docs/api/editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,27 @@ Check if there is content.
editor.isEmpty
```

### isFocused
Check if the editor is focused.

```js
editor.isFocused
```

### isDestroyed
Check if the editor is destroyed.

```js
editor.isDestroyed
```

### isCapturingTransaction
Check if the editor is capturing a transaction.

```js
editor.isCapturingTransaction
```

## Settings

### element
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"scripts": {
"start": "npm --prefix ./demos run start",
"dev": "npm run start",
"lint": "eslint --cache --quiet --no-error-on-unmatched-pattern ./",
"lint:fix": "eslint --fix --cache --quiet --no-error-on-unmatched-pattern ./",
"lint:staged": "lint-staged",
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/NodeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'
import { Editor as CoreEditor } from './Editor'
import { Node } from './Node'
import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types'
import { isAndroid } from './utilities/isAndroid'
import { isiOS } from './utilities/isiOS'

export class NodeView<
Expand Down Expand Up @@ -212,14 +213,15 @@ export class NodeView<
return false
}

// try to prevent a bug on iOS that will break node views on enter
// try to prevent a bug on iOS and Android that will break node views on enter
// this is because ProseMirror can’t preventDispatch on enter
// this will lead to a re-render of the node view on enter
// see: https://github.com/ueberdosis/tiptap/issues/1214
// see: https://github.com/ueberdosis/tiptap/issues/2534
if (
this.dom.contains(mutation.target)
&& mutation.type === 'childList'
&& isiOS()
&& (isiOS() || isAndroid())
&& this.editor.isFocused
) {
const changedNodes = [
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/utilities/isAndroid.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isAndroid(): boolean {
return navigator.platform === 'Android' || /android/i.test(navigator.userAgent)
}

0 comments on commit 38914d6

Please sign in to comment.