Skip to content
Snippets Groups Projects
Commit 921e6df6 authored by john's avatar john
Browse files

cleanup & comments

parent 3ba766c9
No related branches found
No related tags found
No related merge requests found
......@@ -20,12 +20,26 @@ class SimpleImporter extends HTMLImporter {
// override substance's internal function to allow for overlapping
// annotations, without adhering to an expand / fuse mode
// TODO -- extensive comment about why this is needed
_createInlineNodes () {
var state = this.state
var doc = state.doc
// creating annotations afterwards so that the targeted nodes exist for sure
/*
substance will break overlapping annotations of the same type into
pieces like this:
<anno id=1>
<anno id=2></anno>
</anno>
<anno id=2>
</anno>
when the importer finds the duplicate annotation id, it will remove
the first one altogether as a node from the doc
here, we are forcing it to keep these duplicates and merge them
*/
state.inlineNodes.forEach(function (node) {
if (doc.get(node.id)) {
const existing = doc.get(node.id)
......@@ -33,6 +47,7 @@ class SimpleImporter extends HTMLImporter {
doc.delete(node.id)
// only for comments
if (node.id.split('-')[0] === 'comment') {
// if they are adjacent and have the same id, merge the offsets
if (
......@@ -45,7 +60,7 @@ class SimpleImporter extends HTMLImporter {
doc.create(node)
}
} else {
doc.create(node)
doc.create(node) // TODO -- refactor
}
} else {
doc.create(node)
......
......@@ -11,7 +11,6 @@ class CommentBubble extends Tool {
const title = 'Create a new comment'
// console.log('bubble commands', commands.mode)
const icon = $$(Icon, { icon: 'fa-comment' })
.addClass('sc-comment-icon')
......@@ -36,11 +35,6 @@ class CommentBubble extends Tool {
didUpdate () {
this.position()
// // TODO -- ????
// const provider = this.getProvider()
// const activeEntry = provider.getActiveEntry()
// const comments = this.context.commentsProvider.config.comments
// if (typeof comments[activeEntry] === 'undefined' && activeEntry) this.el.css('display', 'none')
}
dispose () {
......@@ -113,7 +107,7 @@ class CommentBubble extends Tool {
return documentSession.getSelection()
}
// TODO -- maybe get from provider?
// TODO -- get from provider
getSurface () {
const surfaceManager = this.context.surfaceManager
return surfaceManager.getFocusedSurface()
......@@ -133,7 +127,7 @@ class CommentBubble extends Tool {
return true
}
// TODO -- move to provider?
// TODO -- move to provider
createComment () {
if (!this.canCreateComment()) return
......
......@@ -238,8 +238,7 @@ class CommentsProvider extends TocProvider {
return this.config.documentSession
}
// TODO -- better comment
// returns the borders of all comment annotations in selection
// returns the combined borders of all comment annotations in selection
getCommentBorders () {
const comments = this.getSelectionComments()
if (comments.length === 0) return
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment