Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Android 8 and 9 compatibility using Mutations #2853

Merged
merged 73 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
1623b9e
Add debug-mutations
thesunny May 22, 2019
d288854
Fix linting
thesunny May 22, 2019
9f6eaf4
Add debug-mutations to o core plugins
thesunny May 22, 2019
2c0d1dd
Merge branch 'master' into debug-mutations-2
thesunny May 22, 2019
411e0f8
Fix debug output
thesunny May 23, 2019
a3693e5
Add comment about debug statement
thesunny May 23, 2019
0fef1f5
Add comment explaining the building of debug output object
thesunny May 23, 2019
ded948a
Merge branch 'master' into mutations
thesunny May 23, 2019
7000a8d
Merge branch 'master' into debug-mutations-2
thesunny May 23, 2019
00130fa
Merge branch 'debug-mutations-2' into mutations
thesunny May 23, 2019
c057b35
Add framework for mutations and mutation observer
thesunny May 23, 2019
8c38fe1
A reasonably working work in progress with Chrome
thesunny May 23, 2019
1f9adb7
Working splitBlock and mergeBlock
thesunny May 23, 2019
5e6ef7f
many things working but not autocorrect
thesunny May 24, 2019
1d23927
All later tests pass
thesunny May 25, 2019
f5f555c
Before adding isComposing to composition-manager
thesunny May 25, 2019
008ea11
Fixit
thesunny May 27, 2019
8bf46a5
Merge branch 'master' into mutations
thesunny May 27, 2019
e8ab7cc
Merge branch 'mutations' into mutations-android
thesunny May 27, 2019
199ca97
fix enter enter backspace backspace
thesunny May 28, 2019
efeb148
Pass all tests except space-back-space-back
thesunny May 28, 2019
c34fca1
Passes all tests I think but doesn't continuous backspace or select d…
thesunny May 28, 2019
1364e6a
Passes all tests and delete selection work
thesunny May 28, 2019
9b4199d
Merge branch 'master' into mutations
thesunny May 28, 2019
8135261
Merge branch 'mutations' into mutations-android
thesunny May 28, 2019
d564771
Fix for merge
thesunny May 28, 2019
81edfd7
Merge branch 'master' into mutations
thesunny May 28, 2019
931691e
Merge branch 'mutations' into mutations-android
thesunny May 28, 2019
3ad9e1c
Passes all tests including typing hello world on new line and enter
thesunny May 28, 2019
1198b71
Before switching to a function
thesunny May 28, 2019
efceede
Fix enter after last char
thesunny May 28, 2019
b304068
Fix it wasn't me. no. bug
thesunny May 28, 2019
52c4b6e
Remove timeout delay on compositionEnd and everthing works except it …
thesunny May 28, 2019
056f9b0
Passes all tests but need to add tests for delete all and select delete
thesunny May 28, 2019
8a131b4
Pass all tests
thesunny May 28, 2019
4a177d2
Merge branch 'master' into mutations-android
thesunny May 28, 2019
e2aa49f
Fix remove selection
thesunny May 28, 2019
cfcc834
Added flush onCompositionEnd just in case
thesunny May 29, 2019
fde6071
Merge branch 'master' into mutations-android
thesunny May 29, 2019
8f6bfbf
Fix bugs for Android 8 split join and fix side effects on Android 9 t…
thesunny May 30, 2019
190692c
Merge
thesunny May 30, 2019
aa98b79
Merge branch 'mutations-android' into mutations-android-8
thesunny May 30, 2019
051fc26
Add comments to composition manager
thesunny May 30, 2019
0363795
Merge branch 'master' into mutations-android
thesunny May 30, 2019
a1f8a28
Clean up code
thesunny May 30, 2019
b7ea43f
Fix bug with delete range
thesunny May 31, 2019
941c124
Add comments
thesunny May 31, 2019
9e73087
Fix focus lost bug on change examples
thesunny May 31, 2019
0c045ec
Improve comments
thesunny May 31, 2019
2eb0cf9
Rename clear to clearAction and a comment
thesunny May 31, 2019
f2b61e8
Rename lastEl to last.rootEl
thesunny May 31, 2019
e772d94
Remove isListening
thesunny May 31, 2019
45fdd9e
Rename vars
thesunny May 31, 2019
60b9e12
Fix bug where changing to new example during a composition messes up …
thesunny May 31, 2019
d7ddd0a
Add comment to switching examples in composition fix
thesunny May 31, 2019
6c6f242
Improve comments
thesunny May 31, 2019
648c9d6
Refactor
thesunny May 31, 2019
d0cabc7
Refactor removeNode
thesunny May 31, 2019
45fe6da
Remove unused event callbacks
thesunny May 31, 2019
5d3f851
Refactor connect
thesunny May 31, 2019
20e67b4
Cleanup mutation plugin
thesunny May 31, 2019
dc5f002
Remove unnecessary comments
thesunny May 31, 2019
7949535
Remove readme
thesunny May 31, 2019
8c3f4a6
Refactor ReactPlugin
thesunny May 31, 2019
5b8c89a
Refactor plugins and injection locations
thesunny May 31, 2019
d3975f8
Remove dom-observer
thesunny May 31, 2019
19899b7
Remove is-input-data helpers
thesunny May 31, 2019
9ec5678
Move fixSelectionInZeroWidthBlock
thesunny May 31, 2019
bd3a00b
Fix some linting and also a composition manager bug
thesunny May 31, 2019
e631420
Fix linting and remove placeholder on Android
thesunny May 31, 2019
9ea4e5c
Refactor
thesunny May 31, 2019
7a9153c
Update composition-manager description
thesunny Jun 4, 2019
cc6322f
Fix comment on composition manager
thesunny Jun 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/slate-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"peerDependencies": {
"immutable": ">=3.8.1 || >4.0.0-rc",
"react": ">=16.6.0",
"react-dom": ">=16.6.0",
"slate": ">=0.47.0"
},
"devDependencies": {
Expand Down
28 changes: 24 additions & 4 deletions packages/slate-react/src/components/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class Content extends React.Component {
isUpdatingSelection: false,
nodeRef: React.createRef(),
nodeRefs: {},
contentKey: 0,
}

/**
Expand Down Expand Up @@ -211,7 +212,7 @@ class Content extends React.Component {
const native = window.getSelection()
const { activeElement } = window.document

if (debug.enabled) {
if (debug.update.enabled) {
debug.update('updateSelection', { selection: selection.toJSON() })
}

Expand Down Expand Up @@ -322,12 +323,23 @@ class Content extends React.Component {
}

this.tmp.isUpdatingSelection = false

debug.update('updateSelection:setTimeout', {
anchorOffset: window.getSelection().anchorOffset,
})
})
}

if (updated && debug.enabled) {
if (updated && (debug.enabled || debug.update.enabled)) {
debug('updateSelection', { selection, native, activeElement })
debug.update('updateSelection-applied', { selection })

debug.update('updateSelection:applied', {
selection: selection.toJSON(),
native: {
anchorOffset: native.anchorOffset,
focusOffset: native.focusOffset,
},
})
}
}

Expand Down Expand Up @@ -470,6 +482,11 @@ class Content extends React.Component {

const window = getWindow(event.target)
const { activeElement } = window.document

debug.update('onNativeSelectionChange', {
anchorOffset: window.getSelection().anchorOffset,
})

if (activeElement !== this.ref.current) return

this.props.onEvent('onSelect', event)
Expand Down Expand Up @@ -512,7 +529,10 @@ class Content extends React.Component {
...props.style,
}

// console.log('rerender content', this.tmp.contentKey, document.text)
thesunny marked this conversation as resolved.
Show resolved Hide resolved

debug('render', { props })
debug.update('render', this.tmp.contentKey, document.text)

this.props.onEvent('onRender')

Expand All @@ -523,7 +543,7 @@ class Content extends React.Component {

return (
<Container
key={this.props.contentKey}
key={this.tmp.contentKey}
{...handlers}
{...data}
ref={this.setRef}
Expand Down
219 changes: 0 additions & 219 deletions packages/slate-react/src/plugins/android/Readme.md

This file was deleted.

Loading