mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	added button for entering workspace
This commit is contained in:
		
							parent
							
								
									1c5425c9eb
								
							
						
					
					
						commit
						2a6978c349
					
				
							
								
								
									
										18
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										18
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -3212,9 +3212,9 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "electron-to-chromium": {
 | 
			
		||||
      "version": "1.3.607",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.607.tgz",
 | 
			
		||||
      "integrity": "sha512-h2SYNaBnlplGS0YyXl8oJWokfcNxVjJANQfMCsQefG6OSuAuNIeW+A8yGT/ci+xRoBb3k2zq1FrOvkgoKBol8g==",
 | 
			
		||||
      "version": "1.3.610",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.610.tgz",
 | 
			
		||||
      "integrity": "sha512-eFDC+yVQpEhtlapk4CYDPfV9ajF9cEof5TBcO49L1ETO+aYogrKWDmYpZyxBScMNe8Bo/gJamH4amQ4yyvXg4g==",
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "electron-window-state": {
 | 
			
		||||
@ -7156,9 +7156,9 @@
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "terser": {
 | 
			
		||||
      "version": "5.5.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/terser/-/terser-5.5.0.tgz",
 | 
			
		||||
      "integrity": "sha512-eopt1Gf7/AQyPhpygdKePTzaet31TvQxXvrf7xYUvD/d8qkCJm4SKPDzu+GHK5ZaYTn8rvttfqaZc3swK21e5g==",
 | 
			
		||||
      "version": "5.5.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/terser/-/terser-5.5.1.tgz",
 | 
			
		||||
      "integrity": "sha512-6VGWZNVP2KTUcltUQJ25TtNjx/XgdDsBDKGt8nN0MpydU36LmbPPcMBd2kmtZNNGVVDLg44k7GKeHHj+4zPIBQ==",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "commander": "^2.20.0",
 | 
			
		||||
@ -7627,9 +7627,9 @@
 | 
			
		||||
      "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w=="
 | 
			
		||||
    },
 | 
			
		||||
    "webpack": {
 | 
			
		||||
      "version": "5.8.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.8.0.tgz",
 | 
			
		||||
      "integrity": "sha512-X2yosPiHip3L0TE+ylruzrOqSgEgsdGyBOGFWKYChcwlKChaw9VodZIUovG1oo7s0ss6e3ZxBMn9tXR+nkPThA==",
 | 
			
		||||
      "version": "5.9.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.9.0.tgz",
 | 
			
		||||
      "integrity": "sha512-YnnqIV/uAS5ZrNpctSv378qV7HmbJ74DL+XfvMxzbX1bV9e7eeT6eEWU4wuUw33CNr/HspBh7R/xQlVjTEyAeA==",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "@types/eslint-scope": "^3.7.0",
 | 
			
		||||
 | 
			
		||||
@ -86,7 +86,7 @@
 | 
			
		||||
    "jsdoc": "3.6.6",
 | 
			
		||||
    "lorem-ipsum": "2.0.3",
 | 
			
		||||
    "rcedit": "2.2.0",
 | 
			
		||||
    "webpack": "5.8.0",
 | 
			
		||||
    "webpack": "5.9.0",
 | 
			
		||||
    "webpack-cli": "4.2.0"
 | 
			
		||||
  },
 | 
			
		||||
  "optionalDependencies": {
 | 
			
		||||
 | 
			
		||||
@ -90,6 +90,14 @@ export default class Entrypoints extends Component {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async hoistNoteCommand({noteId}) {
 | 
			
		||||
        const tabContext = appContext.tabManager.getActiveTabContext();
 | 
			
		||||
 | 
			
		||||
        if (tabContext.hoistedNoteId !== noteId) {
 | 
			
		||||
            await tabContext.setHoistedNoteId(noteId);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async unhoistCommand() {
 | 
			
		||||
        const activeTabContext = appContext.tabManager.getActiveTabContext();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@ export default class LinkMapWidget extends CollapsibleWidget {
 | 
			
		||||
 | 
			
		||||
    get headerActions() {
 | 
			
		||||
        const $showFullButton = $("<a>")
 | 
			
		||||
            .addClass("bx bx-map-alt")
 | 
			
		||||
            .addClass("bx bx-network-chart")
 | 
			
		||||
            .addClass('widget-header-action')
 | 
			
		||||
            .attr('title', 'Show full link map');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@ export default class WhatLinksHereWidget extends CollapsibleWidget {
 | 
			
		||||
 | 
			
		||||
    get headerActions() {
 | 
			
		||||
        const $showFullButton = $("<a>")
 | 
			
		||||
            .addClass("bx bx-map-alt")
 | 
			
		||||
            .addClass("bx bx-network-chart")
 | 
			
		||||
            .addClass('widget-header-action')
 | 
			
		||||
            .attr('title', 'Show full link map');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -36,19 +36,6 @@ const TPL = `
 | 
			
		||||
        padding-bottom: 35px;
 | 
			
		||||
    }
 | 
			
		||||
        
 | 
			
		||||
    .refresh-search-button {
 | 
			
		||||
        cursor: pointer;
 | 
			
		||||
        position: relative;
 | 
			
		||||
        top: -1px;
 | 
			
		||||
        border: 1px solid transparent;
 | 
			
		||||
        padding: 2px;
 | 
			
		||||
        border-radius: 2px;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    .refresh-search-button:hover {
 | 
			
		||||
        border-color: var(--button-border-color);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    .collapse-tree-button {
 | 
			
		||||
        position: absolute;
 | 
			
		||||
        bottom: 10px;
 | 
			
		||||
@ -143,16 +130,21 @@ const TPL = `
 | 
			
		||||
        opacity: 0.6;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .add-note-button {
 | 
			
		||||
        display: none;
 | 
			
		||||
    .tree-item-button {
 | 
			
		||||
        font-size: 120%;
 | 
			
		||||
        padding: 2px;
 | 
			
		||||
        cursor: pointer;
 | 
			
		||||
        border-radius: 3px;
 | 
			
		||||
        border: 1px solid var(--main-background-color);
 | 
			
		||||
        margin-left: 5px;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    .add-note-button:hover {
 | 
			
		||||
        border: 1px solid var(--main-border-color);
 | 
			
		||||
        border-radius: 3px;
 | 
			
		||||
    .tree-item-button:hover {
 | 
			
		||||
        border-color: var(--main-border-color);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    .add-note-button {
 | 
			
		||||
        display: none;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    span.fancytree-node:hover .add-note-button {
 | 
			
		||||
@ -214,6 +206,18 @@ export default class NoteTreeWidget extends TabAwareWidget {
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        this.$tree.on("click", ".enter-workspace-button", e => {
 | 
			
		||||
            const node = $.ui.fancytree.getNode(e);
 | 
			
		||||
 | 
			
		||||
            this.triggerCommand('hoistNote', {noteId: node.data.noteId});
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        this.$tree.on("click", ".unhoist-button", e => {
 | 
			
		||||
            const node = $.ui.fancytree.getNode(e);
 | 
			
		||||
 | 
			
		||||
            this.triggerCommand('unhoist');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // fancytree doesn't support middle click so this is a way to support it
 | 
			
		||||
        this.$tree.on('mousedown', '.fancytree-title', e => {
 | 
			
		||||
            if (e.which === 2) {
 | 
			
		||||
@ -500,14 +504,20 @@ export default class NoteTreeWidget extends TabAwareWidget {
 | 
			
		||||
 | 
			
		||||
                const note = await treeCache.getNote(node.data.noteId);
 | 
			
		||||
 | 
			
		||||
                if (note.hasLabel('workspace')) {
 | 
			
		||||
                    const $enterWorkspaceButton = $('<span class="tree-item-button enter-workspace-button bx bx-door-open" title="Hoist this note (workspace)"></span>');
 | 
			
		||||
 | 
			
		||||
                    $span.append($enterWorkspaceButton);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (note.type === 'search') {
 | 
			
		||||
                    const $refreshSearchButton = $('<span>  <span class="refresh-search-button bx bx-refresh" title="Refresh saved search results"></span></span>');
 | 
			
		||||
                    const $refreshSearchButton = $('<span class="tree-item-button refresh-search-button bx bx-refresh" title="Refresh saved search results"></span>');
 | 
			
		||||
 | 
			
		||||
                    $span.append($refreshSearchButton);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (note.type !== 'search') {
 | 
			
		||||
                    const $createChildNoteButton = $('<span>  <span class="add-note-button bx bx-plus" title="Create child note"></span></span>');
 | 
			
		||||
                    const $createChildNoteButton = $('<span class="tree-item-button add-note-button bx bx-plus" title="Create child note"></span>');
 | 
			
		||||
 | 
			
		||||
                    $span.append($createChildNoteButton);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,9 @@ const BUILTIN_ATTRIBUTES = [
 | 
			
		||||
    { type: 'label', name: 'noteRevisionsWidgetDisabled' },
 | 
			
		||||
    { type: 'label', name: 'whatLinksHereWidgetDisabled' },
 | 
			
		||||
    { type: 'label', name: 'similarNotesWidgetDisabled' },
 | 
			
		||||
    { type: 'label', name: 'workspace' },
 | 
			
		||||
    { type: 'label', name: 'workspaceIconClass' },
 | 
			
		||||
    { type: 'label', name: 'workspaceTabBackgroundColor' },
 | 
			
		||||
 | 
			
		||||
    // relation names
 | 
			
		||||
    { type: 'relation', name: 'runOnNoteCreation', isDangerous: true },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user