From 4a4d67c554c46f8d65c85f162a14af3733a49691 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 21 Nov 2022 20:11:20 -0800 Subject: [PATCH] Add icons to text export. --- .../src/components/export/MDExporter.ts | 15 +++--- .../src/components/export/TxtExporter.ts | 10 +++- packages/mindplot/test/unit/export/Helper.ts | 2 +- .../test/unit/export/expected/complex.txt | 46 +++++++++---------- .../test/unit/export/expected/npe.txt | 12 ++--- .../test/unit/export/expected/welcome.md | 20 ++++---- .../test/unit/export/expected/welcome.txt | 20 ++++---- 7 files changed, 68 insertions(+), 57 deletions(-) diff --git a/packages/mindplot/src/components/export/MDExporter.ts b/packages/mindplot/src/components/export/MDExporter.ts index 26f9b7aa..bcaa4f25 100644 --- a/packages/mindplot/src/components/export/MDExporter.ts +++ b/packages/mindplot/src/components/export/MDExporter.ts @@ -16,6 +16,7 @@ * limitations under the License. */ import { Mindmap } from '../..'; +import EmojiIconModel from '../model/EmojiIconModel'; import INodeModel from '../model/INodeModel'; import LinkModel from '../model/LinkModel'; import NoteModel from '../model/NoteModel'; @@ -63,7 +64,14 @@ class MDExporter extends Exporter { branches .filter((n) => n.getText() !== undefined) .forEach((node) => { - result = `${result}${prefix}- ${node.getText()}`; + // Convert icons to list ... + const icons = node.getFeatures().filter((f) => f.getType() === 'eicon'); + let iconStr = ' '; + if (icons.length > 0) { + iconStr = ` ${icons.map((icon) => (icon as EmojiIconModel).getIconType()).toString()} `; + } + + result = `${result}${prefix}-${iconStr}${node.getText()}`; node.getFeatures().forEach((f) => { const type = f.getType(); // Dump all features ... @@ -76,11 +84,6 @@ class MDExporter extends Exporter { this.footNotes.push(note.getText()); result = `${result}[^${this.footNotes.length}] `; } - - // if(type === 'icon'){ - // const icon = f as IconModel; - // result = result + ` ![${icon.getIconType().replace('_','')}!](https://app.wisemapping.com/images/${icon.getIconType()}.svg )` - // } }); result = `${result}\n`; diff --git a/packages/mindplot/src/components/export/TxtExporter.ts b/packages/mindplot/src/components/export/TxtExporter.ts index 5f02d63b..a0846f9f 100644 --- a/packages/mindplot/src/components/export/TxtExporter.ts +++ b/packages/mindplot/src/components/export/TxtExporter.ts @@ -16,6 +16,7 @@ * limitations under the License. */ import { Mindmap } from '../..'; +import EmojiIconModel from '../model/EmojiIconModel'; import INodeModel from '../model/INodeModel'; import LinkModel from '../model/LinkModel'; import NoteModel from '../model/NoteModel'; @@ -40,7 +41,14 @@ class TxtExporter extends Exporter { private traverseBranch(indent: string, prefix: string, branches: INodeModel[]) { let result = ''; branches.forEach((node, index) => { - result = `${result}${indent}${prefix}${index + 1} ${ + // Convert icons to list ... + const icons = node.getFeatures().filter((f) => f.getType() === 'eicon'); + let iconStr = ' '; + if (icons.length > 0) { + iconStr = ` ${icons.map((icon) => (icon as EmojiIconModel).getIconType()).toString()} `; + } + + result = `${result}${indent}${prefix}${index + 1}${iconStr}${ node.getText() !== undefined ? node.getText() : '' }`; node.getFeatures().forEach((f) => { diff --git a/packages/mindplot/test/unit/export/Helper.ts b/packages/mindplot/test/unit/export/Helper.ts index e4867fb3..b6400d78 100644 --- a/packages/mindplot/test/unit/export/Helper.ts +++ b/packages/mindplot/test/unit/export/Helper.ts @@ -22,7 +22,7 @@ import { diff } from 'jest-diff'; import { expect } from '@jest/globals'; import Exporter from '../../../src/components/export/Exporter'; -const saveOutputRecord = true; +const saveOutputRecord = false; export const setupBlob = () => { // Workaround for partial implementations on Jest: diff --git a/packages/mindplot/test/unit/export/expected/complex.txt b/packages/mindplot/test/unit/export/expected/complex.txt index a581e8a2..d416aeab 100644 --- a/packages/mindplot/test/unit/export/expected/complex.txt +++ b/packages/mindplot/test/unit/export/expected/complex.txt @@ -25,7 +25,7 @@ HR Mission: To provide a positive HR service experience for applicants and emplo [Note: Each department of Freeform will identify areas that need development to meet overall FS goals. Eg. Project Manager may identify needed improvement in a development tool. Or... Bus. Dev. may identify a new need in NFP that FS could fill within mandate, if training were provided. Professional Dev. priority will be given to proposals for development with clear ROIs.] 2.3 Strategic Priority 2c: Learning Environment [Note: Learning and innovation are an essential part of providing the best solutions to NFPs. Cost effective internal learning and time to explore innovation will be encouraged, provided they conform with organization goal and clear ROI is demonstrated.] - 2.4 So That... + 2.4 🌈 So That... [Note: (So that... our employees have improved skills and knowledge, So that... they are highly competent and can work well in agile teams and feel fulfilled and self actualized... So that we can so the best work possible, for the least cost, in the shortest time for other NFPs, So that... NFPs can help those who need it.)] 3 Strategy 4: Inclusive, Positive Environment [Note: Strategy #4: Foster a diverse, inclusive community with a positive work environment.] @@ -36,7 +36,7 @@ HR Mission: To provide a positive HR service experience for applicants and emplo 3.3 Strategic Priority 4c: Diversity [Note: Insure we promote our commitment to diversity and non-discrimination through our actions and in our outreach and employee recruitment efforts] 3.4 - 3.5 So That... + 3.5 🌈 So That... [Note: (So that... we can reflect the diverse populations we serve AND ensure everyone feels safe, respected and included, So that... we better serve our diverse client organizations AND we are a great place to work )] 4 Strategy 1: Recruit & Retain [Note: Recruit and retain top talent commensurate with identified organizational capacity requirements ] @@ -154,18 +154,18 @@ Attached below a sample of such screening questions] [Note: The Freeform H&S rep will lead a Health and Wellness Committee to responsible for recognizing health and safety concerns and identifying solutions.] 11.2.2 Work-life Balance Initiative [Link: http://hrcouncil.ca/hr-toolkit/workplaces-health-safety.cfm] - 11.3 So that... + 11.3 🌈 So that... [Note: (So that... our employees remain well and safe, So that... they are highly competent and can work well in agile teams and feel fulfilled and self actualized... So that we can so the best work possible, for the least cost, in the shortest time for other NFPs, So that... NFPs can help those who need it.)] 12 Benefits [Note: As Freeform Employees we will have benefits reviewed in light of our priorities and cost to Freeform] - 12.1 As Freeform Staff + 12.1 👨‍👧‍👦 As Freeform Staff 12.2 Responsibility: HZ, JC 12.3 Release 3 - 12.4 Have Heather create list benefits against Best Practice & cost + 12.4 ✅ Have Heather create list benefits against Best Practice & cost 12.5 Have Jason review list 12.6 Have JC & HZ consult with staff 12.7 Have best benefits we can afford - 12.8 So that... + 12.8 🌈 So that... [Note: so that our efforts to excel are rewarded.] 13 Community Outreach Plan 13.1 Goals @@ -175,7 +175,7 @@ Attached below a sample of such screening questions] 13.5 Other 14 Backlog Plan [Link: https://docs.google.com/a/freeform.ca/drawings/d/1mrtkVAN3_XefJJCgfxw4Va6xk9TVDBKXDt_uzyIF4Us/edit] - 14.1 Go To Backlog Plan + 14.1 😎 Go To Backlog Plan [Link: https://docs.google.com/a/freeform.ca/drawings/d/1mrtkVAN3_XefJJCgfxw4Va6xk9TVDBKXDt_uzyIF4Us/edit] 15 Strategy Prospecting 15.1 @@ -188,11 +188,11 @@ Attached below a sample of such screening questions] 17 Strategies Marketing 18 19 Exit Interviews - 19.1 As Freeform + 19.1 👨‍👧‍👦 As Freeform 19.2 Responsiblity: HZ, KS - 19.3 Release + 19.3 ⌛ Release 19.4 Have Heather write procedures for exit interview process - 19.5 So that + 19.5 🌈 So that [Note: We learn from our mistakes and missed opportunities in future with the goal of keeping the best talent.] 20 3 Month Onboarding Process 21 Human Resources Plan @@ -208,48 +208,48 @@ Attached below a sample of such screening questions] 21.2 Related Documents [Note: MIssion, Values, Principles, Org Business Plan, Human Resources Policy Manual] 21.3 Goals - 21.3.1 Goal:Staff=Optimal Bus. Growth + 21.3.1 🏈 Goal:Staff=Optimal Bus. Growth [Note: Human resource capacity will remain at a level to meet planned growth growth objectives and client contractual commitments] - 21.3.1.1 So that... + 21.3.1.1 🌈 So that... 21.3.1.2 Related Strategic Priorities: - 21.3.1.3 KPI: HR Level equals Planned Growth + 21.3.1.3 📊 KPI: HR Level equals Planned Growth 21.3.1.4 Methodology [Note: Schedule of required HR capacity vs. actual HR capacity. Variance + or - 1] 21.3.1.4.1 Target [Note: = + or - 1] - 21.3.2 Goal: Increase Job Satisfaction - 21.3.2.1 So That + 21.3.2 🏈 Goal: Increase Job Satisfaction + 21.3.2.1 🌈 So That [Note: Establish better relationships. Identify with the new employer. Build a great attitude with the company.] 21.3.2.2 Related Strategic Priorities 21.3.2.2.1 - 21.3.2.3 KPI: Employee Satisfaction + 21.3.2.3 📊 KPI: Employee Satisfaction 21.3.2.3.1 21.3.2.4 Methodology [Note: Percentage of improvement in employee reported job satisfaction based on survey vs previous year. Base level to be established in first year. ] 21.3.2.4.1 Target [Note: Base level 1st year] - 21.3.3 Goal: Improve Performance + 21.3.3 🏈 Goal: Improve Performance [Note: To increase knowledge, skills and experience of the Freeform staff relevant to organizational priorities.] - 21.3.3.1 So That + 21.3.3.1 🌈 So That [Note: Clarify expectations. Understand values and priorities. Decrease the learning curve.] 21.3.3.2 Related Strategic Priorities [Note: 1] - 21.3.3.3 KPI: Employee Performance + 21.3.3.3 📊 KPI: Employee Performance 21.3.3.4 Methodology 21.3.3.4.1 Target - 21.3.4 Goal: Reduce Turnover + 21.3.4 🏈 Goal: Reduce Turnover [Note: To reduce turnover of Top Talent.] - 21.3.4.1 So That + 21.3.4.1 🌈 So That [Note: Provide support through feedback. Help the employee feel valued. Again, decrease the learning curve.] 21.3.4.2 Related Strategic Priorities - 21.3.4.3 KPI: Retention Rate + 21.3.4.3 📊 KPI: Retention Rate 21.3.4.4 Methodology 21.3.4.4.1 Target - 21.3.5 Risk & Compliance + 21.3.5 🏈 Risk & Compliance [Note: To eliminate or minimize risk and to comply with all legislated requirements. ] diff --git a/packages/mindplot/test/unit/export/expected/npe.txt b/packages/mindplot/test/unit/export/expected/npe.txt index 3d5a9988..517f5e22 100644 --- a/packages/mindplot/test/unit/export/expected/npe.txt +++ b/packages/mindplot/test/unit/export/expected/npe.txt @@ -1,19 +1,19 @@ -1 NIF (NORMAS DE INFORMACIÓN FINANCIERA) -2 NIF D +1 ✏️ NIF (NORMAS DE INFORMACIÓN FINANCIERA) +2 😎 NIF D [Note: Beneficios a los empleados,impuestos a la utilidad, arrendamientos y capitalización de resultado integral .] 2.1 Normas aplicables a problemas de determinación de resultados -3 CIRCULANTES +3 ☎️ CIRCULANTES [Note: Tratamiento contable de los gastos de registro, colocación, unidades de inversión, aplicación supletoria etc.] 3.1 Adquisición temporal de acciones propias -4 NIF A +4 ⌛ NIF A [Link: http://www.youtube.com/watch?v=7YN-sOlkQp0] 4.1 Marco conceptual -5 NIF C +5 🐵 NIF C [Link: https://sites.google.com/site/contabilidadimcpnif/estructura-de-las-nif] 5.1 Normas aplicables a conceptos específicos de los estados financieros 6 NIF E [Note: Agricultura y donativos recibidos u otorgados con propósitos no lucrativos.] 6.1 Normas aplicables alas actividades especializadas de distintos sectores -7 NIF B +7 🏠 NIF B [Link: http://www.contaduria.uady.mx/files/cuerpo-acad/caef/aief/resumen_NIF_marco_conceptual.pdf] 7.1 Normas aplicables a los estados financieros en su conjunto diff --git a/packages/mindplot/test/unit/export/expected/welcome.md b/packages/mindplot/test/unit/export/expected/welcome.md index 1e75b757..00e623d7 100644 --- a/packages/mindplot/test/unit/export/expected/welcome.md +++ b/packages/mindplot/test/unit/export/expected/welcome.md @@ -1,8 +1,8 @@ # Welcome To WiseMapping -- 5 min tutorial video ? +- 🖥️ 5 min tutorial video ? Follow the link ! ( [link](https://www.youtube.com/tv?vq=medium#/watch?v=rKxZwNKs9cE) ) -- Try it Now! +- 😮 Try it Now! - Double Click - Press "enter" to add a Sibling @@ -13,22 +13,22 @@ Sibling - Fonts - Topic Shapes - Topic Color - - Icons - - History Changes -- Mind Mapping + - 🌈 Icons + - ⬅️ History Changes +- 👍 Mind Mapping - Share with Collegues - Online - Anyplace, Anytime - Free!!! -- Productivity - - Share your ideas +- 📊 Productivity + - 💡 Share your ideas - Brainstorming - Visual -- Install In Your Server +- 🖥️ Install In Your Server - Open Source ( [link](http://www.wisemapping.org/) ) - Download ( [link](http://www.wisemapping.com/inyourserver.html) ) -- Collaborate +- 👨‍👧‍👦 Collaborate - Embed - Publish - - Share for Edition + - ✉️ Share for Edition diff --git a/packages/mindplot/test/unit/export/expected/welcome.txt b/packages/mindplot/test/unit/export/expected/welcome.txt index 1b36a120..a6a7a8d7 100644 --- a/packages/mindplot/test/unit/export/expected/welcome.txt +++ b/packages/mindplot/test/unit/export/expected/welcome.txt @@ -1,8 +1,8 @@ 1 Welcome To WiseMapping - 1.1 5 min tutorial video ? + 1.1 🖥️ 5 min tutorial video ? Follow the link ! [Link: https://www.youtube.com/tv?vq=medium#/watch?v=rKxZwNKs9cE] - 1.2 Try it Now! + 1.2 😮 Try it Now! 1.2.1 Double Click 1.2.2 Press "enter" to add a Sibling @@ -14,23 +14,23 @@ Sibling 1.3.2.1 Fonts 1.3.2.2 Topic Shapes 1.3.2.3 Topic Color - 1.3.3 Icons - 1.3.4 History Changes - 1.4 Mind Mapping + 1.3.3 🌈 Icons + 1.3.4 ⬅️ History Changes + 1.4 👍 Mind Mapping 1.4.1 Share with Collegues 1.4.2 Online 1.4.3 Anyplace, Anytime 1.4.4 Free!!! - 1.5 Productivity - 1.5.1 Share your ideas + 1.5 📊 Productivity + 1.5.1 💡 Share your ideas 1.5.2 Brainstorming 1.5.3 Visual - 1.6 Install In Your Server + 1.6 🖥️ Install In Your Server 1.6.1 Open Source [Link: http://www.wisemapping.org/] 1.6.2 Download [Link: http://www.wisemapping.com/inyourserver.html] - 1.7 Collaborate + 1.7 👨‍👧‍👦 Collaborate 1.7.1 Embed 1.7.2 Publish - 1.7.3 Share for Edition + 1.7.3 ✉️ Share for Edition