feat: modify current tags to v4 style
This commit is contained in:
@@ -64,6 +64,7 @@ import { MultipleSelectedNotesDirective } from './components/MultipleSelectedNot
|
|||||||
import { NotesContextMenuDirective } from './components/NotesContextMenu';
|
import { NotesContextMenuDirective } from './components/NotesContextMenu';
|
||||||
import { NotesOptionsPanelDirective } from './components/NotesOptionsPanel';
|
import { NotesOptionsPanelDirective } from './components/NotesOptionsPanel';
|
||||||
import { IconDirective } from './components/Icon';
|
import { IconDirective } from './components/Icon';
|
||||||
|
import { NoteTagsDirective } from './components/NoteTags';
|
||||||
|
|
||||||
function reloadHiddenFirefoxTab(): boolean {
|
function reloadHiddenFirefoxTab(): boolean {
|
||||||
/**
|
/**
|
||||||
@@ -157,7 +158,8 @@ const startApplication: StartApplication = async function startApplication(
|
|||||||
.directive('multipleSelectedNotesPanel', MultipleSelectedNotesDirective)
|
.directive('multipleSelectedNotesPanel', MultipleSelectedNotesDirective)
|
||||||
.directive('notesContextMenu', NotesContextMenuDirective)
|
.directive('notesContextMenu', NotesContextMenuDirective)
|
||||||
.directive('notesOptionsPanel', NotesOptionsPanelDirective)
|
.directive('notesOptionsPanel', NotesOptionsPanelDirective)
|
||||||
.directive('icon', IconDirective);
|
.directive('icon', IconDirective)
|
||||||
|
.directive('noteTags', NoteTagsDirective);
|
||||||
|
|
||||||
// Filters
|
// Filters
|
||||||
angular.module('app').filter('trusted', ['$sce', trusted]);
|
angular.module('app').filter('trusted', ['$sce', trusted]);
|
||||||
|
|||||||
23
app/assets/javascripts/components/NoteTags.tsx
Normal file
23
app/assets/javascripts/components/NoteTags.tsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { AppState } from "@/ui_models/app_state";
|
||||||
|
import { observer } from "mobx-react-lite";
|
||||||
|
import { toDirective } from "./utils";
|
||||||
|
import { Icon } from "./Icon";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
appState: AppState;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NoteTags = observer(({ appState }: Props) => {
|
||||||
|
return (
|
||||||
|
<div className="flex mt-2">
|
||||||
|
{appState.notes.activeNoteTags.map(tag => (
|
||||||
|
<span className="bg-contrast rounded text-sm color-text p-1 flex items-center mr-2">
|
||||||
|
<Icon type="hashtag" className="small color-neutral mr-1" />
|
||||||
|
{tag.title}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export const NoteTagsDirective = toDirective<Props>(NoteTags);
|
||||||
@@ -29,6 +29,7 @@ export class NotesState {
|
|||||||
};
|
};
|
||||||
contextMenuMaxHeight: number | 'auto' = 'auto';
|
contextMenuMaxHeight: number | 'auto' = 'auto';
|
||||||
showProtectedWarning = false;
|
showProtectedWarning = false;
|
||||||
|
activeNoteTags: SNTag[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private application: WebApplication,
|
private application: WebApplication,
|
||||||
@@ -40,6 +41,7 @@ export class NotesState {
|
|||||||
contextMenuOpen: observable,
|
contextMenuOpen: observable,
|
||||||
contextMenuPosition: observable,
|
contextMenuPosition: observable,
|
||||||
showProtectedWarning: observable,
|
showProtectedWarning: observable,
|
||||||
|
activeNoteTags: observable,
|
||||||
|
|
||||||
selectedNotesCount: computed,
|
selectedNotesCount: computed,
|
||||||
trashedNotesCount: computed,
|
trashedNotesCount: computed,
|
||||||
@@ -164,6 +166,11 @@ export class NotesState {
|
|||||||
} else {
|
} else {
|
||||||
this.activeEditor.setNote(note);
|
this.activeEditor.setNote(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
|
this.activeNoteTags = this.application.getAppState().getNoteTags(note);
|
||||||
|
});
|
||||||
|
|
||||||
await this.onActiveEditorChanged();
|
await this.onActiveEditorChanged();
|
||||||
|
|
||||||
if (note.waitingForKey) {
|
if (note.waitingForKey) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
div.flex-grow(
|
div.flex-grow(
|
||||||
ng-class="{'locked' : self.noteLocked}"
|
ng-class="{'locked' : self.noteLocked}"
|
||||||
)
|
)
|
||||||
.title
|
.title.overflow-auto
|
||||||
input#note-title-editor.input(
|
input#note-title-editor.input(
|
||||||
ng-blur='self.onTitleBlur()',
|
ng-blur='self.onTitleBlur()',
|
||||||
ng-change='self.onTitleChange()',
|
ng-change='self.onTitleChange()',
|
||||||
@@ -48,16 +48,20 @@
|
|||||||
ng-style="self.notesLocked && {'pointer-events' : 'none'}",
|
ng-style="self.notesLocked && {'pointer-events' : 'none'}",
|
||||||
application='self.application'
|
application='self.application'
|
||||||
)
|
)
|
||||||
input.tags-input(
|
div.flex
|
||||||
ng-blur='self.onTagsInputBlur()',
|
note-tags(
|
||||||
ng-disabled='self.noteLocked',
|
app-state='self.appState'
|
||||||
ng-if='!self.state.tagsComponent',
|
|
||||||
ng-keyup='$event.keyCode == 13 && $event.target.blur();',
|
|
||||||
ng-model='self.editorValues.tagsInputValue',
|
|
||||||
placeholder='#tags',
|
|
||||||
spellcheck='false',
|
|
||||||
type='text'
|
|
||||||
)
|
)
|
||||||
|
input.tags-input(
|
||||||
|
ng-blur='self.onTagsInputBlur()',
|
||||||
|
ng-disabled='self.noteLocked',
|
||||||
|
ng-if='!self.state.tagsComponent',
|
||||||
|
ng-keyup='$event.keyCode == 13 && $event.target.blur();',
|
||||||
|
ng-model='self.editorValues.tagsInputValue',
|
||||||
|
placeholder='#tags',
|
||||||
|
spellcheck='false',
|
||||||
|
type='text'
|
||||||
|
)
|
||||||
div.flex.items-center
|
div.flex.items-center
|
||||||
#save-status
|
#save-status
|
||||||
.message(
|
.message(
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ $heading-height: 75px;
|
|||||||
.tags-input {
|
.tags-input {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: var(--sn-stylekit-foreground-color);
|
color: var(--sn-stylekit-foreground-color);
|
||||||
width: 100%;
|
|
||||||
border: none;
|
border: none;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
|
|||||||
@@ -53,6 +53,14 @@
|
|||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mr-1 {
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-1 {
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.py-1\.5 {
|
.py-1\.5 {
|
||||||
padding-top: 0.375rem;
|
padding-top: 0.375rem;
|
||||||
padding-bottom: 0.375rem;
|
padding-bottom: 0.375rem;
|
||||||
@@ -167,10 +175,18 @@
|
|||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.overflow-auto {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.items-start {
|
.items-start {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-2 {
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A button that is just an icon. Separated from .sn-button because there
|
* A button that is just an icon. Separated from .sn-button because there
|
||||||
* is almost no style overlap.
|
* is almost no style overlap.
|
||||||
@@ -205,6 +221,11 @@
|
|||||||
@extend .fill-current;
|
@extend .fill-current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sn-icon.small {
|
||||||
|
@extend .h-3\.5;
|
||||||
|
@extend .w-3\.5;
|
||||||
|
}
|
||||||
|
|
||||||
.sn-dropdown {
|
.sn-dropdown {
|
||||||
@extend .bg-default;
|
@extend .bg-default;
|
||||||
@extend .min-w-80;
|
@extend .min-w-80;
|
||||||
|
|||||||
Reference in New Issue
Block a user