Skip to content

Commit dda2449

Browse files
committed
Switch to kirbyup + add structure field preview
1 parent 3e3a43e commit dda2449

File tree

6 files changed

+50
-22
lines changed

6 files changed

+50
-22
lines changed

index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
"author": "Sylvain Julé",
77
"license": "MIT",
88
"scripts": {
9-
"dev": "parcel watch src/index.js --no-source-maps -d ./",
10-
"build": "parcel build src/index.js --no-source-maps --experimental-scope-hoisting -d ./"
9+
"dev": "kirbyup src/index.js --watch",
10+
"build": "kirbyup src/index.js",
11+
"lint": "eslint \"src/**/*.{js,vue}\"",
12+
"lint:fix": "npm run lint -- --fix",
13+
"format": "prettier --write \"src/**/*.{css,js,vue}\""
1114
},
1215
"posthtml": {
1316
"recognizeSelfClosing": true
@@ -18,20 +21,10 @@
1821
"not ie <= 11"
1922
],
2023
"devDependencies": {
21-
"@babel/core": "^7.5.5",
22-
"@babel/plugin-transform-runtime": "^7.5.5",
23-
"@babel/preset-env": "^7.5.5",
24-
"@vue/component-compiler-utils": "^3.3.0",
25-
"babel-plugin-transform-runtime": "^6.23.0",
26-
"babel-polyfill": "^6.26.0",
27-
"cssnano": "^4.1.11",
28-
"oembed-parser": "^1.3.0",
29-
"sass": "^1.43.4",
30-
"vue-template-compiler": "^2.6.14",
31-
"vuelidate": "^0.7.4"
32-
},
33-
"dependencies": {
34-
"vue": "^2.6.10",
35-
"vue-hot-reload-api": "^2.3.3"
24+
"eslint": "^8.2.0",
25+
"eslint-config-prettier": "^8.3.0",
26+
"eslint-plugin-vue": "^8.0.3",
27+
"kirbyup": "^0.21.0",
28+
"prettier": "^2.4.1"
3629
}
3730
}

src/assets/css/styles.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
border-radius: 3px;
3737
}
3838
&-synced {
39-
background: rgba(#a7bd6a, .8);
39+
background: #b9ca88;
4040
display: flex;
4141
align-items: center;
4242
.checkmark {
@@ -119,3 +119,15 @@
119119
opacity: 0.45;
120120
}
121121
}
122+
123+
.k-embed-field-preview-icon {
124+
background: #b9ca88;
125+
width: 18px;
126+
height: 18px;
127+
line-height: 18px;
128+
border-radius: 50%;
129+
display: inline-block;
130+
font-size: .75em;
131+
margin-left: .5em;
132+
text-align: center;
133+
}

src/components/embedPreview.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div class="k-embed-field-preview">
3+
<div class="k-structure-table-text">{{ url }} <span class="k-embed-field-preview-icon" v-if="synced">✓</span></div>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
props: {
10+
value: String,
11+
},
12+
computed: {
13+
url() {
14+
return this.value.input.replace(/^\/\/|^.*?:\/\//, '')
15+
},
16+
synced() {
17+
return Object.keys(this.value.media).length
18+
}
19+
},
20+
};
21+
</script>

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import embedField from './components/embedField.vue'
2-
import embedInput from './components/embedInput.vue'
1+
import embedField from './components/embedField.vue'
2+
import embedInput from './components/embedInput.vue'
3+
import embedPreview from './components/embedPreview.vue'
34

45
panel.plugin('sylvainjule/embed', {
56
fields: {
67
embed: embedField,
78
},
89
components: {
910
'k-embed-input': embedInput,
11+
'k-embed-field-preview': embedPreview,
1012
}
1113
});

0 commit comments

Comments
 (0)