Skip to content

Commit

Permalink
[bugfix] fix copy all as md/txt for tag node fail
Browse files Browse the repository at this point in the history
  • Loading branch information
GarinZ committed Apr 11, 2023
1 parent 62f9385 commit e495bbc
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions src/tree/features/tab-master-tree/nodes/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,25 @@ export const NodeUtils = {
},
convertToText(node: FancytreeNode, level = 0) {
const indent = ' '.repeat(level);
const { nodeType, alias, url, pendingUrl } = node.data;
const { nodeType, url, pendingUrl } = node.data;
let text = '';
if (nodeType === 'tab') {
text += `${indent}${node.title} (${url ?? pendingUrl})`;
} else if (nodeType === 'note') {
text += `${indent}${alias}`;
} else {
text += `${indent}${node.title}`;
}
text +=
nodeType === 'tab'
? `${indent}${node.title} (${url ?? pendingUrl})`
: `${indent}${node.title}`;
const childrenText: string = node.children
? node.children.map((child) => NodeUtils.convertToText(child, level + 1)).join('')
: '';
return `${text}\n${childrenText}`;
},
convertToMarkdown(node: FancytreeNode, level = 0) {
const indent = ' '.repeat(level);
const { nodeType, alias, url, pendingUrl } = node.data;
const { nodeType, url, pendingUrl } = node.data;
let text = '';
if (nodeType === 'tab') {
text += `${indent}- [${node.title}](${url ?? pendingUrl})`;
} else if (nodeType === 'note') {
text += `${indent}- ${alias}`;
} else {
text += `${indent}- ${node.title}`;
}
text +=
nodeType === 'tab'
? `${indent}- [${node.title}](${url ?? pendingUrl})`
: `${indent}- ${node.title}`;
const childrenText: string = node.children
? node.children.map((child) => NodeUtils.convertToMarkdown(child, level + 1)).join('')
: '';
Expand Down

0 comments on commit e495bbc

Please sign in to comment.