diff --git a/package.json b/package.json index dc80f56..7f4d97d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "link-map", "displayName": "Link Map", - "version": "1.0.10", + "version": "1.0.11", "browserslist": "Chrome >= 96", "description": "Vertical Tabs Sidebar, But In Tree Structure", "author": "Garin", diff --git a/public/_locales/zh_CN/messages.json b/public/_locales/zh_CN/messages.json index f281e0f..c9c44f9 100644 --- a/public/_locales/zh_CN/messages.json +++ b/public/_locales/zh_CN/messages.json @@ -168,7 +168,7 @@ "message": "Link Map感觉自己更强大了!" }, "updateNoteContent": { - "message": "在v1.0.0版本中,增加了一些小的改进,可以更细粒度的控制Link Map的行为。如果你感兴趣,只需查看树中的第一个节点来获取细节" + "message": "在v1.0.10版本中,增加了一些小的改进,可以更细粒度的控制Link Map的行为。如果你感兴趣,只需查看树中的第一个节点来获取细节" }, "updateTutorialNode": { "message": "v1.0.10中的新功能" diff --git a/src/background/index.ts b/src/background/index.ts index caf19f9..ddbec66 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -34,10 +34,9 @@ try { await setIsNewUser(true); } if ( - details.reason === 'update' - // && - // details.previousVersion !== '1.0.10' && - // browser.runtime.getManifest().version === '1.0.10' + details.reason === 'update' && + details.previousVersion !== '1.0.10' && + browser.runtime.getManifest().version === '1.0.10' ) { // chrome.runtime.getManifest().version await setIsUpdate(true); diff --git a/src/tree/features/tab-master-tree/nodes/utils.ts b/src/tree/features/tab-master-tree/nodes/utils.ts index 1553f67..d6929ec 100644 --- a/src/tree/features/tab-master-tree/nodes/utils.ts +++ b/src/tree/features/tab-master-tree/nodes/utils.ts @@ -61,12 +61,15 @@ export const NodeUtils = { }, convertToText(node: FancytreeNode, level = 0) { const indent = ' '.repeat(level); - const { nodeType, url, pendingUrl } = node.data; + const { nodeType, url, pendingUrl, alias } = node.data; let text = ''; - text += - nodeType === 'tab' - ? `${indent}${node.title} (${url ?? pendingUrl})` - : `${indent}${node.title}`; + if (nodeType === 'tab') { + text += `${indent}${node.title} (${url ?? pendingUrl})`; + } else if (nodeType === 'note') { + text += `${indent}${alias}`; + } else { + text += `${indent}${node.title}`; + } const childrenText: string = node.children ? node.children.map((child) => NodeUtils.convertToText(child, level + 1)).join('') : ''; @@ -74,12 +77,15 @@ export const NodeUtils = { }, convertToMarkdown(node: FancytreeNode, level = 0) { const indent = ' '.repeat(level); - const { nodeType, url, pendingUrl } = node.data; + const { nodeType, url, pendingUrl, alias } = node.data; let text = ''; - text += - nodeType === 'tab' - ? `${indent}- [${node.title}](${url ?? pendingUrl})` - : `${indent}- ${node.title}`; + if (nodeType === 'tab') { + text += `${indent}- [${node.title}](${url ?? pendingUrl})`; + } else if (nodeType === 'note') { + text += `${indent}- ${alias}`; + } else { + text += `${indent}- ${node.title}`; + } const childrenText: string = node.children ? node.children.map((child) => NodeUtils.convertToMarkdown(child, level + 1)).join('') : ''; diff --git a/src/typings/jquery.fancytree.d.ts b/src/typings/jquery.fancytree.d.ts index 7b34b27..537426a 100644 --- a/src/typings/jquery.fancytree.d.ts +++ b/src/typings/jquery.fancytree.d.ts @@ -18,11 +18,12 @@ declare namespace JQueryUI { } interface JQuery { - fancytree(options?: Fancytree.FancytreeOptions): Fancytree.Fancytree; + fancytree(options?: Fancytree.FancytreeOptions): JQuery; fancytree(option?: string, ...rest: any[]): any; } declare namespace Fancytree { + import Widget = JQueryUI.Widget; type EditTriggerCancelKeys = 'esc' | 'tab' | 'click'; type EditTriggerStartKey = 'f2' | 'mac+enter' | 'shift+click'; type EditEvent = { type: 'beforeClose' | 'beforeEdit' | 'close' | 'edit' | 'save' }; @@ -53,12 +54,14 @@ declare namespace Fancytree { interface Fancytree { $div: JQuery; - widget: any; //JQueryUI.Widget; + widget: Widget; //JQueryUI.Widget; rootNode: FancytreeNode; $container: JQuery; focusNode: FancytreeNode; options: FancytreeOptions; + new (widget: Widget): Fancytree; + /** Activate node with a given key and fire focus and * activate events. A previously activated node will be * deactivated. If activeVisible option is set, all parents @@ -318,6 +321,8 @@ declare namespace Fancytree { unselectableIgnore?: boolean | undefined; unselectableStatus?: boolean | undefined; + new (parent: FancytreeNode, data: NodeData): FancytreeNode; + //#endregion //#region Methods @@ -1244,5 +1249,35 @@ declare namespace Fancytree { unescapeHtml(s: string): string; warn(msg: string): void; + /** Expose class object as `$.ui.fancytree._FancytreeClass`. + * Useful to extend `$.ui.fancytree._FancytreeClass.prototype`. + * @type {Fancytree} + */ + _FancytreeClass: Fancytree; + /** Expose class object as $.ui.fancytree._FancytreeNodeClass + * Useful to extend `$.ui.fancytree._FancytreeNodeClass.prototype`. + * @type {FancytreeNode} + */ + _FancytreeNodeClass: FancytreeNode; + /** Create a new Fancytree instance on a target element. + * + * @param {Element | jQueryObject | string} el Target DOM element or selector + * @param {FancytreeOptions} [opts] Fancytree options + * @returns {Fancytree} new tree instance + * @example + * var tree = $.ui.fancytree.createTree("#tree", { + * source: {url: "my/webservice"} + * }); // Create tree for this matching element + * + * @since 2.25 + */ + createTree(el: Element | JQuery, opts: FancytreeOptions): Fancytree; + /** Return a function that executes *fn* at most every *timeout* ms. + * @param {integer} timeout + * @param {function} fn + * @param {boolean} [invokeAsap=false] + * @param {any} [ctx] + */ + debounce(timeout: number, fn: Function, invokeAsap?: boolean, ctx?: any): Function; } }