-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Drag'n'drop support #445
Merged
Drag'n'drop support #445
Changes from all commits
Commits
Show all changes
340 commits
Select commit
Hold shift + click to select a range
2e6b107
moving caret initial
khaydarov ef6f2d5
small improvements
khaydarov 0ed9238
last changes, added docs
khaydarov c7a5be8
requested changes
khaydarov 8adc54c
implement getters instead of functions in block cursors
khaydarov 4575a24
last requested changes
khaydarov cf4a126
caret module docs and last improvements
khaydarov 8f4b7e5
update docs
khaydarov 6c75a45
upgrade request
khaydarov 6d83636
update docs
khaydarov cdf2ca7
upd
khaydarov 6db88c3
todo on delays
khaydarov 6fd28f3
Merge pull request #242 from codex-team/module-caret
khaydarov d2d85ee
Sanitizer docs
khaydarov 4f8d089
split func upd
1a9167f
split blocks update
ef24b23
Merge branch 'rewriting-version2.0' into Split-Merge-blocks
be575a1
up docs
khaydarov 9dd05d2
Listeners Module: initial
khaydarov 87c94d7
listener module updates
khaydarov 342705b
split is ready
cbfcecd
Merge pull request #243 from codex-team/sanitizer-docs
khaydarov 52ed658
update
khaydarov d46e823
start to make merge
97af4c8
upd
6a4de5f
split general upd
3ae2f9b
ups
khaydarov bbc1d0d
Merge pull request #244 from codex-team/module-listeners
khaydarov df75c79
keyboard module update
45dabb7
BlockManager removed keyboard handler
0869a64
commit before merging rewriting2.0
543b73a
Merge branch 'rewriting-version2.0' into Split-Merge-blocks
0c4c33e
general upd split
92a316e
Documentation upd
909080a
document + listener upd
b4d9485
upd doc
740349c
documentation upd
05b7663
doc upd
2cc8578
listener upd
fe5c99f
update algh extract fragm
Nikitos9I 25f5b1d
upd extractRangeContent
Nikitos9I a4099ca
upd dom.js
Nikitos9I c73ce70
Merge pull request #246 from codex-team/Split-Merge-blocks
Nikitos9I 17acac3
keyboard upd (shift + enter & enableLineBreaks)
Nikitos9I f1e95c3
upd enter pressed
Nikitos9I fb07764
keyboard.js upd
Nikitos9I 2e5894a
enter pressed upd
Nikitos9I 9347e44
documenation added
Nikitos9I feaf00a
documentation upd
Nikitos9I f9a7c0c
Merge pull request #250 from codex-team/Split-Merge-blocks
Nikitos9I c4bdc23
Toolbar: settings zone added. (#252)
neSpecc e6c3fc7
Making a Toolbar
neSpecc eded07b
delete block
khaydarov d29b3ae
dom improvements and merging blocks
khaydarov 7c7f978
merge and split improvements
khaydarov d2470fe
fix merging
khaydarov 0f0de88
do not remove block if block contains media
khaydarov e3be9ea
optimize code
khaydarov 3ebf499
caret behaviour improved
khaydarov b61fac8
up
khaydarov 550e3ce
up
khaydarov 0d8257e
merging blocks. Now plugins handles this cases
khaydarov e2041c9
mergeable getter
khaydarov c92f3f9
save
khaydarov d969f7d
up
khaydarov 01a1b96
dom getdeepestnode improvements
khaydarov fb3e6fd
improve getDeepest node method one more time
khaydarov b4220c8
upd
khaydarov 58d640a
Deal with it
neSpecc 12e1d37
improve isAtStart
neSpecc d5b0ebe
improve docs
neSpecc e1028fa
use smart isAtStart and isAtEnt method in navigateNext/navigatePrevious
neSpecc 4636c7a
improve docs
neSpecc e85725f
fix bug in $.isEmpty, improve keydown
neSpecc 768348f
fix isAtEnd
neSpecc fc44297
rollback setCaret code duplication
neSpecc 24a7b9c
improve backspace
neSpecc beeecba
Debug tree walker
neSpecc 5c08eda
fix tree walker
neSpecc f8043ff
small caret fix
neSpecc 3ac9ee9
queue ordering
khaydarov 1f30fa2
update bundle
neSpecc 373579c
improve first letter checkup
neSpecc 9c303ed
doc upd
neSpecc 51a5ffe
update current block index setter
neSpecc d8747e5
Merge pull request #254 from codex-team/daily
khaydarov dbb4cd6
TypeScript support, Webpack 4, Inline Toolbar beginning (#257)
neSpecc cba999a
Inline Toolbar moving (#258)
neSpecc cd6edef
default settings initial
khaydarov 7945bce
add move up button to default tunes area
khaydarov 57ee838
need to figure out with assets
khaydarov 36f505c
Inline Toolbar Tools base example (#260)
neSpecc 0cddf41
save
khaydarov 32aa383
Merge branch 'rewriting-version2.0' into default-editor-settings
khaydarov 93ddb25
tunes with interface
khaydarov 36bc3e4
add tool settings
khaydarov 59347e3
initial api methods
khaydarov 022023f
api is ready
khaydarov ca5beae
started writing docs
khaydarov 543d35f
Create svg sprite (#261)
neSpecc 2573fd6
API
neSpecc 5526648
requested changes
khaydarov 08a6549
Merge branch 'default-editor-settings' of https://github.com/codex-te…
khaydarov 4413764
Merge branch 'rewriting-version2.0' into default-editor-settings
khaydarov cac6bac
fix conflicts
khaydarov 84aa54b
add docs
khaydarov 9d59e9c
doc fixes and interface improvements
khaydarov c85f9d0
update
khaydarov 110603a
API scopes improved
neSpecc 572f56f
Merge pull request #262 from codex-team/default-editor-settings
khaydarov 295e425
Deleting block: Initial
khaydarov 1b5260e
Delete block with confirmation
khaydarov 4efaf0d
Event subscription&unsubscription
khaydarov 242b9b5
deletion trigger improvements
khaydarov ad78d12
small improvements
khaydarov 60eda57
Merge pull request #263 from codex-team/delete-block
khaydarov c665677
Link Inline Tool (#264)
neSpecc 9c41fc4
Delete tune fixes
khaydarov 972eb87
UI: Block Settings, show Plus after Enter keydown (#265)
neSpecc 779bf5d
Merge branch 'delete-tune-fixes' into rewriting-version2.0
khaydarov d0126e0
Revert "Merge branch 'delete-tune-fixes' into rewriting-version2.0"
khaydarov 088a537
Delete Tune improvements
khaydarov c4f49d0
upd
khaydarov 65397b7
upd comments
khaydarov fa492e5
actualize API docs
khaydarov 430277e
Merge pull request #267 from codex-team/delete-tune-improvements
khaydarov a8c5fea
Allow to connect external Inline Tools (#269)
neSpecc 5ba9b80
Italic inline tool
talyguryn 4ab74f3
update icon size
talyguryn f72626c
Merge pull request #270 from codex-team/italic-tool
talyguryn 0197397
upgrade findParentTag function
talyguryn b3723d0
add interface selection
talyguryn 8ef971a
fix cs
talyguryn 773ef46
save marker
talyguryn ff74576
bundles
talyguryn 97f04e6
add todo
talyguryn a95e236
removing wrapper
talyguryn e17ccbf
update styles
talyguryn 319cabb
market -> term
talyguryn 2428849
add comments
talyguryn f898492
improve code
neSpecc f1febf7
descrease margin
neSpecc 0c918b5
add text block to example
talyguryn 4f46afc
add line brakes
talyguryn 8112e48
remove space
talyguryn d7d59bf
fix bugs
neSpecc 4b61ea5
fix bug
neSpecc a5c682a
Merge pull request #271 from codex-team/marker
talyguryn 1bbb136
umd as a library target
talyguryn 69b70cc
Merge pull request #272 from codex-team/umd
talyguryn e21c645
background -> background-color
talyguryn 73f5de3
Merge pull request #273 from codex-team/fix-css
talyguryn 782a600
Clear API (#274)
talyguryn 5222fe3
rename plugin name field in data object (#276)
talyguryn 903093b
Text tool refactored (#277)
neSpecc 72c2240
do not add block if tool is not exist (#278)
talyguryn 832f0ca
Module Keyboard rewrited to BlockEvents (#279)
neSpecc 640e44b
Move-up tune (#268)
khaydarov 1853cfa
Eslint --fix for project files (#280)
gohabereg 3d03461
Header plugin (#281)
talyguryn 9c961bd
"MoveDown" tune (#283)
khaydarov ea64562
Fix merge function and rename Block's wrapper (#284)
khaydarov 8696b9c
Merging blocks: Restore caret position 🤟🤟💪 (#286)
khaydarov f951ced
hide toolbar and selection on typing (#289)
talyguryn 3398383
Editor Instance config Interface (#285)
talyguryn cbb4746
update editor interface (#293)
talyguryn dc7afd1
При перемещении по стрелочкам убирать выделение блока (#296)
talyguryn 29d2bae
update toolbar design (#301)
talyguryn 4b1d933
Set caret at the end if clicked outsite the block (#305)
khaydarov bc3f193
Insert new Block when enter pressed on editor area (#307)
khaydarov 7a67d38
Add placeholder to contentEditable elements (#306)
talyguryn f2ef201
Close toolbar after block is removed (#314)
khaydarov 835e698
makeSettings -> renderSettings (#315)
talyguryn f45521d
Term: new icon, new style. + margin between settings buttons (#316)
neSpecc 83655d3
Tool's renderToolboxIcon function (#318)
talyguryn 4346b4b
Paste (#259)
gohabereg 9cc108e
Resolve conflict
gohabereg 877e2de
Replace current block if it is empty (#320)
gohabereg c844b55
Improve Header line-height (#321)
neSpecc d3a7af9
Fix typo (#324)
gohabereg 6571589
Installation docs (#325)
talyguryn 2443672
Module Shortcuts (#317)
khaydarov 9027974
Simple Image Tool (#326)
neSpecc 11c9746
Fix toolbox appearance, tools boxed are clickable (#331)
talyguryn df3fd63
Remove toolsConfig from Editor's config (#327)
talyguryn 07eb1b7
update dev dep packages (#333)
talyguryn dfb35da
Check is paste handler a function only if it exists (#328)
gohabereg 1533af4
Toolbar with tab (#330)
khaydarov e190d67
Validate editor's config before initing (#341)
talyguryn c7549a9
Styles API (#343)
talyguryn 1775e3c
List Tool [new] (#344)
neSpecc 46bc5db
Example page improved (#347)
neSpecc 3ba88fa
Header plugin (#348)
talyguryn b8db945
Improve paste behaviour (#346)
gohabereg ea881f0
Quote Tool (#329)
gohabereg 9ca4e70
items -> blocks (#351)
talyguryn d9b0e5e
use SimpleImage from cdn (#355)
talyguryn 1e3551a
Update text on the example.html (#356)
neSpecc 3fca65f
use Paragraph Tool from CDN (#357)
talyguryn faac5ab
Remove _callbacks.js (#358)
neSpecc 657fe98
Clear unused files (#359)
neSpecc d0f7e3e
TOOLBAR_ICON_CLASS -> TOOLBAR_ICON (#360)
talyguryn 61adb11
Delimiter tool (#362)
talyguryn e854008
Enter on editor (#363)
khaydarov dbe862c
add Element.prepend() function (#365)
talyguryn 545ce14
use List Tool from cdn (#366)
talyguryn 7d30b04
Pass "config" from Tool's settings to Tool's constructor (#367)
talyguryn 605154c
use string as a object's key 😔 (#368)
talyguryn ef2d25e
update placeholder's styles (#369)
talyguryn 5206e03
Add shortcuts for internal tools (#370)
neSpecc 43ffd4d
use quote from cdn (#371)
talyguryn c349c87
Add cache to the inline tools (#372)
neSpecc b593dc6
use Inline Code Tool from cdn (#375)
talyguryn 6850019
Issue 354 inline tools filter (#376)
neSpecc 9d1a33b
fix endless cycle (#378)
talyguryn e88d1d3
Destructured options for Inline Tools (#379)
talyguryn 3a72af8
Fix toolbar moving after arrow navigation (#380)
neSpecc e1ad086
add example Tools as submodules (#381)
talyguryn 672f7ae
Merge branch 'master' into rewriting-version2.0
neSpecc a58c8d2
Input navigation (#339)
gohabereg 7b73a15
New readme 🦅 (#386)
neSpecc 5f63cbd
Issue 374 (#385)
gohabereg 7517620
Paragraph as a default Tool in editor; Zero-conf (#389)
talyguryn d7b9c47
enable minifying (#390)
talyguryn 883ffd9
Drop current block index only if there is no selection at the Editor …
gohabereg a4ef357
Migrate to Yarn (#393)
gohabereg bfb6308
Rewrite helpers classes to TypeScript (#396)
gohabereg 5dccbc9
Add docs and isReady promise (#394)
gohabereg 570710d
set default holderId value (#404)
talyguryn b291625
Destroyer (#392)
gohabereg a5cf1bf
Add drag'n'drop support
gohabereg e00764d
Add docs
gohabereg 1b86c8a
Merge branch 'master' of https://github.com/codex-team/codex.editor i…
gohabereg f03e8ec
Small fix
gohabereg 6a58ac7
Continue merging master :|
gohabereg 7e9283b
Fixes after merge
gohabereg ecfc5e9
Merge branch 'master' of https://github.com/codex-team/codex.editor i…
3a53db2
Merge branch 'master' of https://github.com/codex-team/codex.editor i…
b74045d
Add styles and improve behavior
dac1eb4
Close inline toolbar and remove dragged content
gohabereg 2f9dbe8
Some improvements of paste data processing
b20a767
Delete selection content only if drag has been started at editor
gohabereg f7c066c
Add comments
gohabereg f83988e
Support of pasting from copy-buffer
gohabereg d83c18f
Change header level
gohabereg a9247b8
Improvements
bf6c30d
Use isDraNDrop flag
d0068ff
Update example
8ee5fff
Improve d'n'd behaviour
bf694e5
git pull for simple-image tool
talyguryn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule simple-image
updated
from b3ba0e to 943897
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import SelectionUtils from '../selection'; | ||
|
||
declare var Module: any; | ||
|
||
export default class DragNDrop extends Module { | ||
|
||
/** | ||
* If drag has been started at editor, we save it | ||
* | ||
* @type Boolean | ||
* @private | ||
*/ | ||
private isStartedAtEditor = false; | ||
|
||
/** | ||
* Bind events | ||
* | ||
* @private | ||
*/ | ||
public prepare(): void { | ||
this.bindEvents(); | ||
} | ||
|
||
/** | ||
* Add drag events listeners to editor zone | ||
* @private | ||
*/ | ||
private bindEvents(): void { | ||
this.Editor.Listeners.on(this.Editor.UI.nodes.holder, 'drop', this.processDrop, true); | ||
|
||
this.Editor.Listeners.on(this.Editor.UI.nodes.holder, 'dragstart', (dragEvent: DragEvent) => { | ||
|
||
if (SelectionUtils.isAtEditor && !SelectionUtils.isCollapsed) { | ||
this.isStartedAtEditor = true; | ||
} | ||
|
||
this.Editor.InlineToolbar.close(); | ||
}); | ||
|
||
/* Prevent default browser behavior to allow drop on non-contenteditable elements */ | ||
this.Editor.Listeners.on(this.Editor.UI.nodes.holder, 'dragover', (e) => e.preventDefault(), true); | ||
} | ||
|
||
/** | ||
* Handle drop event | ||
* | ||
* @param {DragEvent} dropEvent | ||
*/ | ||
private processDrop = async (dropEvent: DragEvent): Promise<void> => { | ||
const { | ||
BlockManager, | ||
Paste, | ||
} = this.Editor; | ||
|
||
dropEvent.preventDefault(); | ||
|
||
BlockManager.blocks.forEach((block) => block.dropTarget = false); | ||
|
||
if (SelectionUtils.isAtEditor && !SelectionUtils.isCollapsed && this.isStartedAtEditor) { | ||
document.execCommand('delete'); | ||
} | ||
|
||
this.isStartedAtEditor = false; | ||
|
||
/** | ||
* Try to set current block by drop target. | ||
* If drop target (error will be thrown) is not part of the Block, set last Block as current. | ||
*/ | ||
try { | ||
neSpecc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
BlockManager.setCurrentBlockByChildNode(dropEvent.target, 'end'); | ||
} catch (e) { | ||
BlockManager.setCurrentBlockByChildNode(BlockManager.lastBlock.holder, 'end'); | ||
} | ||
|
||
Paste.processDataTransfer(dropEvent.dataTransfer, true); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше для более понятного примера написать png, jpg