Browse Source

1 env seulement pr défaut, pas de choix d'env si 1 seul de dispo

master
choj 4 years ago
parent
commit
7c87073cca
3 changed files with 35 additions and 14 deletions
  1. +4
    -4
      public/env/envlist.json
  2. +23
    -5
      src/components/Dedediteur.vue
  3. +8
    -5
      src/environments/Environement.js

+ 4
- 4
public/env/envlist.json View File

@@ -3,8 +3,8 @@ window.environments = [
'name':'typobasic', 'name':'typobasic',
'desc': "Environnement de rédaction contenant l'ensemble des élements typographiques de base." 'desc': "Environnement de rédaction contenant l'ensemble des élements typographiques de base."
}, },
{
'name':'courrier',
'desc': "Environnement permettant la rédaction d'un courrier."
}
// {
// 'name':'courrier',
// 'desc': "Environnement permettant la rédaction d'un courrier."
// }
]; ];

+ 23
- 5
src/components/Dedediteur.vue View File

@@ -137,9 +137,22 @@
T4 T4
</button> </button>


<button v-if="environment.hasParagraphOption('ol')"
class="menubar__button"
:class="{ 'is-active': isActive.ordered_list() }"
@click="commands.ordered_list">
OL
</button>

<button v-if="environment.hasParagraphOption('ul')"
class="menubar__button"
:class="{ 'is-active': isActive.bullet_list() }"
@click="commands.bullet_list">
UL
</button>
<button v-if="environment.hasParagraphOption('quote')" <button v-if="environment.hasParagraphOption('quote')"
class="menubar__button" class="menubar__button"
:class="{ 'is-active': isActive.blockquote() }"
:class="{ 'is-active': isActive.blockquote()}"
@click="commands.blockquote"> @click="commands.blockquote">
« » « »
</button> </button>
@@ -186,7 +199,6 @@
MetaEditor MetaEditor
}, },
data() { data() {
console.log(window.environments);
return { return {
nbWords: 0, nbWords: 0,
nbParagraphs: 0, nbParagraphs: 0,
@@ -206,6 +218,7 @@
new Heading({levels: [1, 2, 3]}), new Heading({levels: [1, 2, 3]}),
new ListItem(), new ListItem(),
new OrderedList(), new OrderedList(),
new BulletList(),
new Link(), new Link(),
new CustomStyle() new CustomStyle()
], ],
@@ -325,8 +338,13 @@
}, },


newFile() { newFile() {
this.isOpeningState = true;
//this.editor.setContent('<p></p>');
console.log(this.environmentList.length)
if(this.environmentList.length > 1) {
this.isOpeningState = true;
}
else{
this.openEnvFile(this.environmentList[0].name)
}
}, },


htmlExport() { htmlExport() {
@@ -335,7 +353,6 @@


htmlPreview(){ htmlPreview(){
this.isPreviewMode = ! this.isPreviewMode; this.isPreviewMode = ! this.isPreviewMode;
//document.getElementById('preview_button').innerHTML = this.isPreviewMode ? '&times;' :'';
}, },


openEnvFile(envName){ openEnvFile(envName){
@@ -370,6 +387,7 @@
font-size: 0.8rem; font-size: 0.8rem;
display: flex; display: flex;
align-items: center; align-items: center;
padding-left: $button-width;


div { div {
display: flex; display: flex;


+ 8
- 5
src/environments/Environement.js View File

@@ -14,7 +14,9 @@ export default class Environment {
T2: true, T2: true,
T3: true, T3: true,
T4: true, T4: true,
quote: true
quote: true,
ul: true,
ol: true
}, },


characters: [ characters: [
@@ -78,6 +80,10 @@ export default class Environment {
{ {
label: "typo", label: "typo",
styles: [ styles: [
{
"label": "italique",
"class": "emphasis"
},
{ {
"label": "indice", "label": "indice",
"class": "subscript" "class": "subscript"
@@ -85,11 +91,8 @@ export default class Environment {
{ {
"label": "exposant", "label": "exposant",
"class": "superscript" "class": "superscript"
},
{
"label": "emphase",
"class": "emphasis"
} }

] ]
} }
], ],


Loading…
Cancel
Save