@mixd-id/web-scaffold 0.1.230406393 → 0.1.230406394

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406393",
4
+ "version": "0.1.230406394",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
 
4
- <div class="overflow-x-auto bg-text-50">
4
+ <div class="overflow-x-auto bg-text-50" :class="containerClass">
5
5
  <div class="flex flex-row">
6
6
  <button class="p-3" type="button" @click="format('bold')">
7
7
  <svg width="14" height="14" class="fill-text-400 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M0 64C0 46.3 14.3 32 32 32H80 96 224c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128H96 80 32c-17.7 0-32-14.3-32-32s14.3-32 32-32H48V256 96H32C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64H112V224H224zM112 288V416H256c35.3 0 64-28.7 64-64s-28.7-64-64-64H224 112z"/></svg>
@@ -21,7 +21,7 @@
21
21
  <button class="p-3" type="button" ref="listBtn" @click="$refs.listContext.open($refs.listBtn)">
22
22
  <svg width="14" height="14" class="fill-text-400 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M64 144c26.5 0 48-21.5 48-48s-21.5-48-48-48S16 69.5 16 96s21.5 48 48 48zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zM64 464c26.5 0 48-21.5 48-48s-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48zm48-208c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48z"/></svg>
23
23
  </button>
24
- <button class="p-3" type="button" @click="createImage">
24
+ <button v-if="uploadImage" class="p-3" type="button" @click="createImage">
25
25
  <svg width="14" height="14" class="fill-text-400 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M152 120c-26.51 0-48 21.49-48 48s21.49 48 48 48s48-21.49 48-48S178.5 120 152 120zM447.1 32h-384C28.65 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM463.1 409.3l-136.8-185.9C323.8 218.8 318.1 216 312 216c-6.113 0-11.82 2.768-15.21 7.379l-106.6 144.1l-37.09-46.1c-3.441-4.279-8.934-6.809-14.77-6.809c-5.842 0-11.33 2.529-14.78 6.809l-75.52 93.81c0-.0293 0 .0293 0 0L47.99 96c0-8.822 7.178-16 16-16h384c8.822 0 16 7.178 16 16V409.3z"/></svg>
26
26
  </button>
27
27
  <button class="p-3" type="button" @click="createLink">
@@ -35,7 +35,7 @@
35
35
  </div>
36
36
 
37
37
  <article ref="article" contenteditable="true" v-html="html" @paste="onPaste" spellcheck="false"
38
- @input="onInput" @click="onClick"
38
+ @input="onInput" @click="onClick" :class="containerClass"
39
39
  @blur="onBlur">
40
40
  </article>
41
41
 
@@ -258,7 +258,9 @@ export default{
258
258
 
259
259
  props:{
260
260
  modelValue: String,
261
- uploadImage: String
261
+ uploadImage: String,
262
+ containerClass: String,
263
+ itemClass: String,
262
264
  },
263
265
 
264
266
  computed: {
@@ -546,9 +546,11 @@ export default{
546
546
  selectPreset(idx){
547
547
  if(this.config.presets[idx]){
548
548
  this.configParams.presetIdx = this.config.presets[idx].uid
549
+ console.log('idx', this.config.presets)
550
+ console.log('idx', idx, this.configParams.presetIdx)
549
551
  this.load()
550
- this.$refs.presetSelector.close()
551
- this.$refs.contextMenu.close()
552
+ this.$refs.presetSelector?.close()
553
+ this.$refs.contextMenu?.close()
552
554
  }
553
555
  },
554
556
 
@@ -141,11 +141,14 @@ export default{
141
141
  close(){
142
142
  if(this.hash){
143
143
 
144
- const hash = this.$route.hash
144
+ let hash = this.$route.hash
145
145
  .split('#')
146
146
  .filter(_ => _.length > 0 && !_.startsWith(this.hash.substring(1)))
147
147
  .join('#')
148
148
 
149
+ if(hash.substring(0, 1) !== '#')
150
+ hash = '#' + hash
151
+
149
152
  this.$router.replace({
150
153
  ...this.$route,
151
154
  hash
@@ -536,16 +536,20 @@ function capitalize(str) {
536
536
  }
537
537
 
538
538
  const removeUnderscoredKey = (obj) => {
539
- if(typeof obj === 'object' && obj !== null){
539
+ if (Array.isArray(obj)) {
540
+ return obj.map(removeUnderscoredKey);
541
+ }
542
+ else if (obj !== null && typeof obj === 'object') {
540
543
  for(let key in obj){
541
544
  if(key.startsWith('_')){
542
545
  delete obj[key]
543
546
  }
544
- else if(Array.isArray(obj[key])){
545
- obj[key].forEach(_ => removeUnderscoredKey(_))
547
+ else if(Array.isArray(obj[key]) || (obj[key] !== null && typeof obj[key] === 'object')){
548
+ removeUnderscoredKey(obj[key])
546
549
  }
547
550
  }
548
551
  }
552
+ return obj;
549
553
  }
550
554
 
551
555
  const hashMake = async (text) => {
@@ -202,8 +202,9 @@ const generateTotalColumns = (preset, items) => {
202
202
  items.push(totalItem)
203
203
  }
204
204
 
205
+ let presetUidSalt = 0
205
206
  const getPresetUid = function(extra = ''){
206
- return md5('preset-' + new Date().getTime() + extra)
207
+ return md5('preset-' + new Date().getTime() + extra + (++presetUidSalt))
207
208
  }
208
209
 
209
210
  export {