Redo search on editor load

This commit is contained in:
Mo Bitar
2019-06-03 17:15:35 -05:00
parent 0a816ec2f3
commit 44c0a336c2
4 changed files with 15 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ angular.module('app')
})
.controller('EditorCtrl', function ($sce, $timeout, authManager, $rootScope, actionsManager,
syncManager, modelManager, themeManager, componentManager, storageManager, sessionHistory,
privilegesManager, keyboardManager) {
privilegesManager, keyboardManager, desktopManager) {
this.spellcheck = true;
this.componentManager = componentManager;
@@ -644,6 +644,10 @@ angular.module('app')
Components
*/
this.onEditorLoad = function(editor) {
desktopManager.redoSearch();
}
componentManager.registerHandler({identifier: "editor", areas: ["note-tags", "editor-stack", "editor-editor"], activationHandler: (component) => {
if(component.area === "note-tags") {
// Autocomplete Tags

View File

@@ -5,6 +5,7 @@ class ComponentView {
this.templateUrl = "directives/component-view.html";
this.scope = {
component: "=",
onLoad: "=",
manualDealloc: "="
};
@@ -118,6 +119,7 @@ class ComponentView {
$timeout(() => {
$scope.loading = false;
$scope.issueLoading = desktopError; /* Typically we'd just set this to false at this point, but we now account for desktopError */
$scope.onLoad && $scope.onLoad($scope.component);
}, 7)
})

View File

@@ -70,9 +70,16 @@ class DesktopManager {
if(!this.isDesktop) {
return;
}
this.lastSearchedText = text;
this.searchHandler(text);
}
redoSearch() {
if(this.lastSearchedText) {
this.searchText(this.lastSearchedText);
}
}
deregisterUpdateObserver(observer) {
_.pull(this.updateObservers, observer);

View File

@@ -75,7 +75,7 @@
%panel-resizer.left{"ng-if" => "ctrl.marginResizersEnabled", "panel-id" => "'editor-content'", "on-resize-finish" => "ctrl.onPanelResizeFinish","control" => "ctrl.leftResizeControl", "min-width" => 300, "property" => "'left'", "hoverable" => "true"}
%component-view.component-view{"ng-if" => "ctrl.selectedEditor", "component" => "ctrl.selectedEditor"}
%component-view.component-view{"ng-if" => "ctrl.selectedEditor", "component" => "ctrl.selectedEditor", "on-load" => "ctrl.onEditorLoad"}
%textarea.editable#note-text-editor{"ng-if" => "!ctrl.selectedEditor", "ng-model" => "ctrl.note.text", "ng-readonly" => "ctrl.note.locked",
"ng-change" => "ctrl.contentChanged()", "ng-trim" => "false", "ng-click" => "ctrl.clickedTextArea()",