@hostlink/nuxt-light 1.63.0 → 1.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.63.0",
4
+ "version": "1.64.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -5,8 +5,11 @@ const $q = useQuasar();
5
5
  const editorRef = ref(null);
6
6
  const textColorRef = ref(null);
7
7
  const textHightlightRef = ref(null);
8
+ const insertTableRef = ref(null);
8
9
  const highlight = ref("#ffff00aa");
9
10
  const foreColor = ref("#000000");
11
+ const tableRows = ref(3);
12
+ const tableCols = ref(3);
10
13
  const TextColorCMD = ((cmd, name) => {
11
14
  const edit = editorRef.value;
12
15
  textColorRef.value.hide();
@@ -21,6 +24,24 @@ const TextHightlightCMD = ((cmd, name) => {
21
24
  edit.runCmd(cmd, name);
22
25
  edit.focus();
23
26
  });
27
+ const insertTableCMD = () => {
28
+ const edit = editorRef.value;
29
+ insertTableRef.value.hide();
30
+ edit.caret.restore();
31
+ let tableHTML = '<table border="1" style="border-collapse: collapse; width: 100%;">\n';
32
+ for (let i = 0; i < tableRows.value; i++) {
33
+ tableHTML += " <tr>\n";
34
+ for (let j = 0; j < tableCols.value; j++) {
35
+ const tag = i === 0 ? "th" : "td";
36
+ tableHTML += ` <${tag} style="padding: 8px; border: 1px solid #ddd;">${tag === "th" ? `Header ${j + 1}` : ""}</${tag}>
37
+ `;
38
+ }
39
+ tableHTML += " </tr>\n";
40
+ }
41
+ tableHTML += "</table>";
42
+ edit.runCmd("insertHTML", tableHTML);
43
+ edit.focus();
44
+ };
24
45
  const emit = defineEmits(["update:modelValue"]);
25
46
  const props = defineProps({
26
47
  fullscreen: { type: Boolean, required: false, skipCheck: true },
@@ -140,6 +161,7 @@ const newToolBar = [
140
161
  },
141
162
  "textColor",
142
163
  "textHightlight",
164
+ "insertTable",
143
165
  "custom_btn",
144
166
  "removeFormat"
145
167
  ],
@@ -221,5 +243,41 @@ const newFonts = {
221
243
  </q-item>
222
244
  </q-btn-dropdown>
223
245
  </template>
246
+ <template v-slot:insertTable>
247
+ <q-btn-dropdown dense no-caps ref="insertTableRef" no-wrap unelevated color="white" text-color="default"
248
+ label="Insert Table" icon="sym_o_table_chart" size="sm">
249
+ <q-card style="min-width: 250px;">
250
+ <q-card-section>
251
+ <div class="text-subtitle2">Create HTML Table</div>
252
+ </q-card-section>
253
+ <q-card-section>
254
+ <div class="q-gutter-md">
255
+ <q-input
256
+ v-model.number="tableRows"
257
+ type="number"
258
+ label="Rows"
259
+ min="1"
260
+ max="20"
261
+ dense
262
+ outlined
263
+ />
264
+ <q-input
265
+ v-model.number="tableCols"
266
+ type="number"
267
+ label="Columns"
268
+ min="1"
269
+ max="10"
270
+ dense
271
+ outlined
272
+ />
273
+ </div>
274
+ </q-card-section>
275
+ <q-card-actions align="right">
276
+ <q-btn flat label="Cancel" color="grey" v-close-popup />
277
+ <q-btn flat label="Insert" color="primary" @click="insertTableCMD" />
278
+ </q-card-actions>
279
+ </q-card>
280
+ </q-btn-dropdown>
281
+ </template>
224
282
  </q-editor>
225
283
  </template>
@@ -114,9 +114,6 @@ const loadItems = async () => {
114
114
  let path = selectedLocation.value;
115
115
  files.value = [];
116
116
  folders.value = [];
117
- if (!path) {
118
- return;
119
- }
120
117
  if (label.value || localSearch.value) {
121
118
  loading.value = true;
122
119
  const items2 = await fs.find(localSearch.value, label.value);
@@ -125,6 +122,9 @@ const loadItems = async () => {
125
122
  folders.value = items2.filter((item) => item.__typename === "Folder");
126
123
  return;
127
124
  }
125
+ if (!path) {
126
+ return;
127
+ }
128
128
  loading.value = true;
129
129
  const folder = await fs.list(path);
130
130
  loading.value = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.63.0",
3
+ "version": "1.64.0",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",