diff --git a/src/App.vue b/src/App.vue index e998dc7..67c3b15 100644 --- a/src/App.vue +++ b/src/App.vue @@ -77,23 +77,13 @@ target="_blank"> {{ compiler.icon }} {{ name }} - - - - + + @click="copyToClipboard( + stripTags( + (name === 'Cherri' ? cherriCode : jellyCode).replace('
', '\n') + ) + )"/> @@ -161,6 +151,7 @@ import { f7Toolbar, f7View, } from 'framework7-vue'; +import {computed} from 'vue'; export default { name: 'App', @@ -198,7 +189,7 @@ export default { glyphs: glyphs, glyph: {identifier: 'identifier', code: null}, colors: colors, - color: {name: null, code: null}, + color: {identifier: null, code: null}, compilers: { 'Cherri': { icon: '🍒', @@ -209,6 +200,22 @@ export default { url: 'https://jellycuts.com/', }, }, + cherriCode: computed(() => { + let code = `#define glyph ${this.glyph.identifier}`; + if (this.color.identifier) { + code += `
#define color ${this.color.identifier}`; + } + + return code; + }), + jellyCode: computed(() => { + let code = `#Icon: ${this.glyph.identifier}`; + if (this.color.identifier) { + code += `
#Color: ${this.jellyColorName()}`; + } + + return code; + }), githubCredits: ['atnbueno', 'actuallytaylor', 'electrikmilk', 'chrisjmendez'], }; }, @@ -233,6 +240,9 @@ export default { closeTimeout: 2000, }).open(); }, + stripTags(str) { + return str.replace(/<\/?[^>]+(>|$)/gi, ''); + }, iconClass(n) { let classes = {}; classes[`g${n}`] = true;