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
a0d09c1f
Commit
a0d09c1f
authored
8 years ago
by
chris
Committed by
john
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
delete a note callout deletes the associated isolated note
parent
f25d900b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/components/SimpleEditor/ContainerEditor.js
+2
-2
2 additions, 2 deletions
app/components/SimpleEditor/ContainerEditor.js
app/components/SimpleEditor/panes/Notes/NotesProvider.js
+36
-2
36 additions, 2 deletions
app/components/SimpleEditor/panes/Notes/NotesProvider.js
with
38 additions
and
4 deletions
app/components/SimpleEditor/ContainerEditor.js
+
2
−
2
View file @
a0d09c1f
...
@@ -34,8 +34,8 @@ class ContainerEditor extends SubstanceContainerEditor {
...
@@ -34,8 +34,8 @@ class ContainerEditor extends SubstanceContainerEditor {
didMount
()
{
didMount
()
{
super
.
didMount
()
super
.
didMount
()
const
containerId
=
this
.
getContainerId
()
if
(
this
.
isEmpty
())
this
.
createText
()
if
(
this
.
isEmpty
()
&&
containerId
!==
'
mini
'
)
this
.
createText
()
// TODO -- why this and not this.focus ?
// TODO -- why this and not this.focus ?
this
.
el
.
focus
()
this
.
el
.
focus
()
...
...
This diff is collapsed.
Click to expand it.
app/components/SimpleEditor/panes/Notes/NotesProvider.js
+
36
−
2
View file @
a0d09c1f
...
@@ -30,6 +30,9 @@ class NotesProvider extends TOCProvider {
...
@@ -30,6 +30,9 @@ class NotesProvider extends TOCProvider {
mini
:
entriesMini
mini
:
entriesMini
}
}
if
(
entriesMini
&&
entriesMain
.
length
<
entriesMini
.
length
)
{
this
.
findDeletedNote
(
entries
)
}
return
entries
return
entries
}
}
...
@@ -97,9 +100,9 @@ class NotesProvider extends TOCProvider {
...
@@ -97,9 +100,9 @@ class NotesProvider extends TOCProvider {
createIsolatedNote
(
note
)
{
createIsolatedNote
(
note
)
{
const
notes
=
this
.
computeEntries
()
const
notes
=
this
.
computeEntries
()
const
containerId
=
this
.
getMiniContainerId
()
let
surface
=
this
.
config
.
miniEditorContext
.
surfaceManager
.
getSurface
(
containerId
)
if
(
notes
.
mini
&&
notes
.
mini
.
length
>
0
)
{
if
(
notes
.
mini
&&
notes
.
mini
.
length
>
0
)
{
const
containerId
=
this
.
getMiniContainerId
()
let
surface
=
this
.
config
.
miniEditorContext
.
surfaceManager
.
getSurface
(
containerId
)
let
container
=
surface
.
getContainer
()
let
container
=
surface
.
getContainer
()
let
findIndex
=
_
.
findIndex
(
notes
.
main
,
[
'
id
'
,
note
.
id
])
let
findIndex
=
_
.
findIndex
(
notes
.
main
,
[
'
id
'
,
note
.
id
])
...
@@ -112,6 +115,7 @@ class NotesProvider extends TOCProvider {
...
@@ -112,6 +115,7 @@ class NotesProvider extends TOCProvider {
}
}
})
})
}
else
{
}
else
{
surface
.
createText
()
this
.
config
.
miniEditorSession
.
transaction
(
function
(
tx
)
{
this
.
config
.
miniEditorSession
.
transaction
(
function
(
tx
)
{
let
nodeData
=
this
.
createNodeData
(
note
)
let
nodeData
=
this
.
createNodeData
(
note
)
tx
.
insertBlockNode
(
nodeData
)
tx
.
insertBlockNode
(
nodeData
)
...
@@ -119,6 +123,36 @@ class NotesProvider extends TOCProvider {
...
@@ -119,6 +123,36 @@ class NotesProvider extends TOCProvider {
}
}
}
}
findDeletedNote
(
entries
)
{
let
position
let
note
if
(
entries
.
main
.
length
===
0
)
{
position
=
0
note
=
entries
.
mini
[
0
]
}
else
{
_
.
forEach
(
entries
.
main
,
function
(
mainNote
)
{
_
.
forEach
(
entries
.
mini
,
function
(
miniNote
)
{
if
(
miniNote
.
parentNoteId
!==
mainNote
.
id
)
{
position
=
_
.
findIndex
(
entries
.
mini
,
[
'
id
'
,
miniNote
.
id
])
note
=
miniNote
}
})
})
}
return
this
.
removeIsolatedNote
(
position
,
note
)
}
removeIsolatedNote
(
position
,
note
)
{
const
containerId
=
this
.
getMiniContainerId
()
let
surface
=
this
.
config
.
miniEditorContext
.
surfaceManager
.
getSurface
(
containerId
)
let
container
=
surface
.
getContainer
()
this
.
config
.
miniEditorSession
.
transaction
(
function
(
tx
)
{
tx
.
update
(
container
.
getContentPath
(),
{
type
:
'
delete
'
,
pos
:
position
})
tx
.
delete
(
note
.
id
)
})
}
getMiniContainerId
()
{
getMiniContainerId
()
{
return
this
.
config
.
miniEditorContext
.
editor
.
props
.
containerId
return
this
.
config
.
miniEditorContext
.
editor
.
props
.
containerId
}
}
...
...
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