Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax-prosemirror
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wax
wax-prosemirror
Commits
95abe5b2
Commit
95abe5b2
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
remove unused file
parent
cb837dce
No related branches found
No related tags found
1 merge request
!235
Images
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-components/src/components/fileUpload.js
+0
-53
0 additions, 53 deletions
wax-prosemirror-components/src/components/fileUpload.js
with
0 additions
and
53 deletions
wax-prosemirror-components/src/components/fileUpload.js
deleted
100644 → 0
+
0
−
53
View file @
cb837dce
const
findPlaceholder
=
(
state
,
id
,
placeholderPlugin
)
=>
{
const
decos
=
placeholderPlugin
.
getState
(
state
);
const
found
=
decos
.
find
(
null
,
null
,
spec
=>
spec
.
id
===
id
);
return
found
.
length
?
found
[
0
].
from
:
null
;
};
export
default
(
view
,
fileUpload
,
placeholderPlugin
)
=>
file
=>
{
console
.
log
(
'
flffl
'
,
fileUpload
);
const
{
state
}
=
view
;
// A fresh object to act as the ID for this upload
const
id
=
{};
// Replace the selection with a placeholder
const
{
tr
}
=
state
;
if
(
!
tr
.
selection
.
empty
)
tr
.
deleteSelection
();
tr
.
setMeta
(
placeholderPlugin
,
{
add
:
{
id
,
pos
:
tr
.
selection
.
from
},
});
view
.
dispatch
(
tr
);
const
pos
=
findPlaceholder
(
view
.
state
,
id
,
placeholderPlugin
);
// If the content around the placeholder has been deleted, drop
// the image
if
(
pos
==
null
)
{
return
;
}
// Otherwise, insert it at the placeholder's position, and remove
// the placeholder
view
.
dispatch
(
state
.
tr
.
replaceWith
(
pos
,
pos
,
view
.
state
.
schema
.
nodes
.
image
.
create
({
src
:
url
,
}),
)
.
setMeta
(
placeholderPlugin
,
{
remove
:
{
id
}
}),
);
// fileUpload(file).then(
// url => {
// },
// () => {
// // On failure, just clean up the placeholder
// view.dispatch(tr.setMeta(placeholderPlugin, { remove: { id } }));
// }
// );
};
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment