Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
editoria
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
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
Yannis Barlas
editoria
Commits
5bada9f4
Commit
5bada9f4
authored
8 years ago
by
chris
Committed by
john
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cleanup note tool
parent
8863ce30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/components/SimpleEditor/elements/note/EditNoteTool.js
+0
-54
0 additions, 54 deletions
app/components/SimpleEditor/elements/note/EditNoteTool.js
with
0 additions
and
54 deletions
app/components/SimpleEditor/elements/note/EditNoteTool.js
+
0
−
54
View file @
5bada9f4
import
{
each
,
includes
,
keys
}
from
'
lodash
'
import
{
each
,
includes
,
keys
}
from
'
lodash
'
import
{
import
{
documentHelpers
,
documentHelpers
,
EditorSession
,
ProseEditorConfigurator
as
Configurator
,
Tool
Tool
}
from
'
substance
'
}
from
'
substance
'
import
MiniEditor
from
'
../../miniEditor/miniEditor
'
import
config
from
'
../../miniEditor/config
'
import
Importer
from
'
../../SimpleEditorImporter
'
import
SimpleExporter
from
'
../../SimpleEditorExporter
'
class
EditNoteTool
extends
Tool
{
class
EditNoteTool
extends
Tool
{
constructor
(
props
)
{
super
(
props
)
this
.
saveNote
=
this
.
saveNote
.
bind
(
this
)
}
render
(
$$
)
{
render
(
$$
)
{
const
miniEditorSession
=
this
.
_initMiniEditor
()
const
selected
=
this
.
getSelection
()
const
selected
=
this
.
getSelection
()
const
provider
=
this
.
getProvider
()
const
provider
=
this
.
getProvider
()
...
@@ -26,9 +14,6 @@ class EditNoteTool extends Tool {
...
@@ -26,9 +14,6 @@ class EditNoteTool extends Tool {
if
(
!
selected
.
node
)
return
el
if
(
!
selected
.
node
)
return
el
el
.
append
(
$
$
(
MiniEditor
,
{
editorSession
:
miniEditorSession
}))
provider
.
config
.
miniEditorContext
.
editor
.
emit
(
'
noteSelected
'
,
'
paragraph-71bf75436a5f9b56700064c6ee2116ab
'
)
provider
.
config
.
miniEditorContext
.
editor
.
emit
(
'
noteSelected
'
,
'
paragraph-71bf75436a5f9b56700064c6ee2116ab
'
)
return
el
return
el
}
}
...
@@ -37,27 +22,6 @@ class EditNoteTool extends Tool {
...
@@ -37,27 +22,6 @@ class EditNoteTool extends Tool {
this
.
context
.
editorSession
.
onUpdate
(
''
,
this
.
disableTools
,
this
)
this
.
context
.
editorSession
.
onUpdate
(
''
,
this
.
disableTools
,
this
)
}
}
_initMiniEditor
()
{
const
selected
=
this
.
getSelection
()
if
(
!
selected
.
node
)
return
const
configurator
=
new
Configurator
().
import
(
config
)
configurator
.
addImporter
(
'
html
'
,
Importer
)
const
importer
=
configurator
.
createImporter
(
'
html
'
)
const
doc
=
importer
.
importDocument
(
selected
.
node
[
'
note-content
'
])
const
editorSession
=
new
EditorSession
(
doc
,
{
configurator
:
configurator
})
editorSession
.
setSaveHandler
({
saveDocument
:
this
.
saveNote
})
return
editorSession
}
disableTools
()
{
disableTools
()
{
const
selected
=
this
.
getSelection
()
const
selected
=
this
.
getSelection
()
if
(
!
selected
.
node
)
return
if
(
!
selected
.
node
)
return
...
@@ -69,24 +33,6 @@ class EditNoteTool extends Tool {
...
@@ -69,24 +33,6 @@ class EditNoteTool extends Tool {
this
.
rerender
()
this
.
rerender
()
}
}
saveNote
(
source
)
{
const
selected
=
this
.
getSelection
()
const
config
=
this
.
context
.
editorSession
.
configurator
.
config
const
exporter
=
new
SimpleExporter
(
config
)
const
convertedSource
=
exporter
.
exportDocument
(
source
)
const
editorSession
=
this
.
context
.
editorSession
editorSession
.
transaction
(
function
(
tx
,
args
)
{
const
path
=
[
selected
.
node
.
id
,
'
note-content
'
]
tx
.
set
(
path
,
convertedSource
)
})
// Return dummy Promise needed in saveDocument
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
()
})
}
getSelection
()
{
getSelection
()
{
// TODO -- write cleaner
// TODO -- write cleaner
const
surface
=
this
.
context
.
surfaceManager
.
getFocusedSurface
()
const
surface
=
this
.
context
.
surfaceManager
.
getFocusedSurface
()
...
...
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