This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
/
CreateNoteModal.html
90 lines (81 loc) 路 3.17 KB
/
CreateNoteModal.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<form action="">
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Create {{gistsSelected ? 'gist' : 'note'}}</p>
<h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated name in your note files...</h2>
</header>
<section class="modal-card-body">
<b-field v-if="!gistsSelected" horizontal label="Name">
<b-input
type="text"
ref="noteName"
v-model="note.name"
placeholder="Your note name">
</b-input>
</b-field>
<b-field horizontal label="Description">
<b-input
type="text"
ref="noteDescription"
v-model="note.description"
placeholder="Your description">
</b-input>
</b-field>
<b-field v-if="!gistsSelected" horizontal label="Tags">
<b-taginput
v-model="note.tags"
maxtags="5">
</b-taginput>
</b-field>
<b-field v-if="gistsSelected" horizontal label="Visibility">
<b-select placeholder="Select a visibility" v-model="note.public">
<option :value="false">Secret</option>
<option :value="true">Public</option>
</b-select>
</b-field>
<div class="note-file" v-for="file in files">
<b-field horizontal label="Name" grouped>
<b-input
style="width: 186px"
type="text"
v-model="file.name"
placeholder="Your file name">
</b-input>
<p class="control is-pulled-right" v-if="files.length > 1">
<button class="button is-danger" @click="deleteFile(file)">
<b-icon icon="trash"></b-icon>
</button>
</p>
</b-field>
<b-field horizontal label="Language">
<v-select style="width: 186px" label="name" :options="sortedLanguagesByUse" placeholder="Select a language"
v-model="file.language" :reduce="selectedLanguage => selectedLanguage.name">
<template v-slot:option="option">
{{ option.name | capitalize }}
</template>
</v-select>
<b-button pill v-for="languageTag in sortedLanguagesByUse.slice(0,3)" :style="'background-color: ' + stringToColour(languageTag.name) + '; color: #fff;'"
:key="languageTag.name" @click="file.language = languageTag.name">{{languageTag.name}}</b-button>
</b-field>
<b-field horizontal label="Content">
<editor v-model="file.content"
:lang="file.language"
theme="monokai"
width="100%"
height="260"
></editor>
</b-field>
</div>
<div class="text-center">
<button class="button" type="button" @click="addFile()" v-if="files.length < 5">
<b-icon id="plus" icon="plus"></b-icon>
Add a file
</button>
</div>
</section>
<footer class="modal-card-foot">
<button class="button" type="button" @click="$parent.close()">Cancel</button>
<button class="button is-primary" type="button" :disabled="isDisabled" @click="createNote()">Create</button>
</footer>
</div>
</form>