Skip to content

Commit

Permalink
improve writer view
Browse files Browse the repository at this point in the history
  • Loading branch information
shuart committed May 11, 2024
1 parent a1bf98e commit 74b6ae0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var setCurrentTags = function () {
var instancesRepo = createInstancesManagement()
var instances = instancesRepo.getAll()

return instances.map(i=>({id:i.uuid, tag:i.name}))
return instances.map(i=>({id:i.uuid, tag:i.name, icon:"./img/icons/"+i.iconPath}))
}

var getEvaluatorData = function (event, data, instance){
Expand Down Expand Up @@ -168,7 +168,7 @@ var updateTable = function (event, data, instance) {
console.log(editor.otherEntries);

editor.mentionsDefs= [
{name:"hashtag", key:"#", attributes:["id", "tag"], attributeToDisplay:'tag'},
{name:"hashtag", key:"#", attributes:["id", "tag"], attributeToDisplay:'tag', imageAttributes:"icon"},
{name:"mention", key:"@", attributes:["name", "id","email"], attributeToDisplay:'name'},
{name:"arrow", key:"->", attributes:["id","tag"], attributeToDisplay:'tag'},
]
Expand All @@ -191,7 +191,11 @@ var updateTable = function (event, data, instance) {
}

var setUpTable = function (event, data, instance) {
updateTable(event, data, instance)
updateTable(event, data, instance)
setTimeout(function(){
updateTableInstance(event, data, instance)// if use current is activated
}, 500)

// subscribeToChanges(event, data, instance, updateTable)
subscribeToSearchParam(event, data, instance, updateTableInstance)
}
Expand Down
18 changes: 15 additions & 3 deletions src/js/vendor/writer/mention/defaultPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,21 @@ export var getDefaultMentionPlugin = function (defs, lists, callbacks) {

}

var getTagSuggestionsHTML = (items,type) => '<div class="suggestion-item-list">'+
items.map(i => '<div class="suggestion-item">'+i[defsMap[type].attributeToDisplay]+'</div>').join('')+
'</div>';
// var getTagSuggestionsHTML = (items,type) => '<div class="suggestion-item-list">'+
// items.map(i => '<div class="suggestion-item">'+i[defsMap[type].attributeToDisplay]+'</div>').join('')+
// '</div>';
var getTagSuggestionsHTML = function (items,type) {
if (defsMap[type].imageAttributes) {
return '<div class="suggestion-item-list">'+
items.map(i => '<div class="suggestion-item"><img style="height: 18px; margin-right: 6px;" src="'+i[defsMap[type].imageAttributes]+'">'+i[defsMap[type].attributeToDisplay]+'</div>').join('')+
'</div>';
}else{
return '<div class="suggestion-item-list">'+
items.map(i => '<div class="suggestion-item">'+i[defsMap[type].attributeToDisplay]+'</div>').join('')+
'</div>';
}

}

/**
* IMPORTANT: outer div's "suggestion-item-list" class is mandatory. The plugin uses this class for querying.
Expand Down

0 comments on commit 74b6ae0

Please sign in to comment.