= [];
-
- constructor() { }
-
- ngOnInit() {
- }
-
- onRecordChange($event) {
- this.recordChange.emit($event);
- }
-
- onKeyUp($event) {
- }
-
- onUlKeyDown($event, index) {
- if ( $event.code === 'Tab' ) {
- $event.preventDefault();
- const elem = this.liItems.toArray()[index];
- let currentLevel = 0;
-
- elem.nativeElement.className.split(' ').some(x => {
- if ( x.startsWith('node-indentation-level-num-') ) {
- currentLevel = Number(x.replace('node-indentation-level-num-', ''));
- return true;
- }
- });
-
- const newLevel = $event.shiftKey ? currentLevel - 1 : currentLevel + 1;
- if ( newLevel <= 5 && newLevel >= 0 ) {
- const existing = elem.nativeElement.className.split(' ').filter(x => !x.startsWith('node-indentation-level-num-'));
- existing.push(`node-indentation-level-num-${newLevel}`);
-
- elem.nativeElement.className = existing.join(' ');
- }
- }
- }
-
- onUlKeyUp($event, i) {
- if ( $event.code === 'Enter' && !$event.shiftKey ) {
- const e = this.liItems.toArray()[i].nativeElement;
- e.innerText = e.innerText.trim();
- if ( this.liItems.toArray()[i].nativeElement.innerText.trim() === '' ) {
- this.newHostRequested.emit(this);
- } else {
- this.listLines.push('');
- setTimeout(() => {
- this.focusStart(this.liItems.toArray()[i + 1].nativeElement);
-
- let newLevel = 0;
- this.liItems.toArray()[i].nativeElement.className.split(' ').some(x => {
- if ( x.startsWith('node-indentation-level-num-') ) {
- newLevel = Number(x.replace('node-indentation-level-num-', ''));
- return true;
- }
- });
-
- const classes = this.liItems.toArray()[i + 1].nativeElement.className
- .split(' ')
- .filter(x => !x.startsWith('node-indentation-level-num-'));
- classes.push(`node-indentation-level-num-${newLevel}`);
- this.liItems.toArray()[i + 1].nativeElement.className = classes.join(' ');
- }, 0);
- }
- } else if ( $event.code === 'Backspace' && this.liItems.toArray()[i].nativeElement.innerText.trim() === '' ) {
- const newLines = [];
- this.liItems.toArray().forEach((elem, index) => {
- if ( index !== i ) {
- newLines.push(elem.nativeElement.innerText ? elem.nativeElement.innerText.trim() : '');
- }
- });
-
- this.listLines = newLines;
-
- if ( i === 0 && this.listLines.length === 0 ) {
- this.destroyHostRequested.emit(this);
- } else {
- setTimeout(() => {
- this.focusEnd(this.liItems.toArray()[i - 1].nativeElement);
- }, 0);
- }
- } else if ( $event.code === 'ArrowDown' ) {
- const liArr = this.liItems.toArray();
- if ( liArr.length > i + 1 ) {
- setTimeout(() => {
- this.focusStart(this.liItems.toArray()[i + 1].nativeElement);
- }, 0);
- }
- } else if ( $event.code === 'ArrowUp' ) {
- if ( i !== 0 ) {
- setTimeout(() => {
- this.focusStart(this.liItems.toArray()[i - 1].nativeElement);
- }, 0);
- }
- } else {
- const recordValue = this.liItems.toArray().map(item => {
- const elem = item.nativeElement;
- const value = elem.innerText.trim();
- let indentationLevel = 0;
- elem.className.split(' ').some(x => {
- if ( x.startsWith('node-indentation-level-num-') ) {
- indentationLevel = x.replace('node-indentation-level-num-', '');
- return true;
- }
- });
-
- return {value, indentationLevel};
- });
-
- this.record.value = JSON.stringify(recordValue);
- }
- }
-
- onRequestDelete($event) {
- this.destroyHostRequested.emit(this);
- }
-
- onRequestParentSave($event) {
- this.saveHostRequested.emit(this);
- }
-
- onHostDblClick() {
- }
-
- takeFocus(fromTop = true) {
- }
-
- // TODO return an observable here, probably
- focusEnd(item) {
- const s = window.getSelection();
- const r = document.createRange();
- r.setStart(item, 0);
- r.setEnd(item, 0);
- s.removeAllRanges();
- s.addRange(r);
- }
-
- // TODO return an observable here, probably
- focusStart(item) {
- const s = window.getSelection();
- const r = document.createRange();
- r.setStart(item, 0);
- r.setEnd(item, 0);
- s.removeAllRanges();
- s.addRange(r);
-
- setTimeout(() => {
- const r2 = document.createRange();
- r2.selectNodeContents(item);
- r2.collapse(false);
- const s2 = window.getSelection();
- s2.removeAllRanges();
- s2.addRange(r2);
- }, 0);
- }
-}
diff --git a/src/app/components/editor/node-picker/node-picker.component.html b/src/app/components/editor/node-picker/node-picker.component.html
index 9429edd..41df36f 100644
--- a/src/app/components/editor/node-picker/node-picker.component.html
+++ b/src/app/components/editor/node-picker/node-picker.component.html
@@ -12,7 +12,7 @@
Code Editor
-
+
Upload Files
diff --git a/src/app/components/editor/node-picker/node-picker.component.scss b/src/app/components/editor/node-picker/node-picker.component.scss
index 36c2c84..a7f2b95 100644
--- a/src/app/components/editor/node-picker/node-picker.component.scss
+++ b/src/app/components/editor/node-picker/node-picker.component.scss
@@ -19,3 +19,9 @@ i {
color: var(--noded-background-code);
}
}
+
+.files {
+ i {
+ color: var(--noded-background-files);
+ }
+}
diff --git a/src/app/components/search/Search.component.scss b/src/app/components/search/Search.component.scss
index aea9b27..b2d1742 100644
--- a/src/app/components/search/Search.component.scss
+++ b/src/app/components/search/Search.component.scss
@@ -36,6 +36,12 @@
color: var(--noded-background-code);
}
}
+
+ &.files {
+ .search-icon {
+ color: var(--noded-background-files);
+ }
+ }
}
.search-assoc {
diff --git a/src/app/pages/editor/editor.page.html b/src/app/pages/editor/editor.page.html
index e1d83b5..9b26cd3 100644
--- a/src/app/pages/editor/editor.page.html
+++ b/src/app/pages/editor/editor.page.html
@@ -23,7 +23,7 @@
*ngFor="let node of editorService.immutableNodes"
>
-
+
diff --git a/src/app/pages/editor/editor.page.scss b/src/app/pages/editor/editor.page.scss
index 74b1270..6846c83 100644
--- a/src/app/pages/editor/editor.page.scss
+++ b/src/app/pages/editor/editor.page.scss
@@ -28,6 +28,10 @@ ion-icon.invisible {
&.database_ref {
color: var(--noded-background-db);
}
+
+ &.file_ref {
+ color: var(--noded-background-files);
+ }
}
.host-add-button {
diff --git a/src/app/pages/editor/editor.page.ts b/src/app/pages/editor/editor.page.ts
index f8bbb21..617d77c 100644
--- a/src/app/pages/editor/editor.page.ts
+++ b/src/app/pages/editor/editor.page.ts
@@ -97,6 +97,10 @@ export class EditorPage implements OnInit {
popover.onDidDismiss().then(result => {
console.log('adding node', result.data);
+ if ( !result.data ) {
+ return;
+ }
+
this.editorService.addNode(result.data, position, positionNodeId);
});
diff --git a/src/app/structures/node-types.ts b/src/app/structures/node-types.ts
index 703adc1..e7397c6 100644
--- a/src/app/structures/node-types.ts
+++ b/src/app/structures/node-types.ts
@@ -7,4 +7,6 @@ export const NodeTypeIcons = {
database_ref: 'fa fa-database',
code: 'fa fa-code',
code_ref: 'fa fa-code',
+ file_ref: 'fa fa-archive',
+ files: 'fa fa-archive',
};
diff --git a/src/global.scss b/src/global.scss
index eb20474..5e09cc6 100644
--- a/src/global.scss
+++ b/src/global.scss
@@ -46,6 +46,10 @@
--noded-background-code: #FF006E;
--noded-color-code: white;
--noded-background-code-hover: #FF5CA3;
+
+ --noded-background-files: #0E7B81;
+ --noded-color-files: white;
+ --noded-background-files-hover: #14AFB8;
}
div.picker-wrapper {