Commit a3be2a77 authored by Nick's avatar Nick

feat: editor modals translations

parent 1a143d84
extends: extends:
- requarks - requarks
- plugin:vue/recommended - plugin:vue/strongly-recommended
env: env:
node: true node: true
jest: true jest: true
...@@ -12,4 +12,4 @@ globals: ...@@ -12,4 +12,4 @@ globals:
document: false document: false
navigator: false navigator: false
window: false window: false
FuseBox: false FuseBox: false
\ No newline at end of file
<template lang='pug'> <template lang='pug'>
v-toolbar.radius-7(flat, :color='$vuetify.dark ? "grey darken-4-l3" : "grey lighten-3"') v-toolbar.radius-7(flat, :color='$vuetify.dark ? "grey darken-4-l3" : "grey lighten-3"')
.body-2.mr-3 Every .body-2.mr-3 {{$t('common:duration.every')}}
v-text-field( v-text-field(
solo solo
hide-details hide-details
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
reverse reverse
v-model='minutes' v-model='minutes'
) )
.body-2.mx-3 Minute(s) .body-2.mx-3 {{$t('common:duration.minutes')}}
v-divider.mr-3() v-divider.mr-3()
v-text-field( v-text-field(
solo solo
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
reverse reverse
v-model='hours' v-model='hours'
) )
.body-2.mx-3 Hour(s) .body-2.mx-3 {{$t('common:duration.hours')}}
v-divider.mr-3() v-divider.mr-3()
v-text-field( v-text-field(
solo solo
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
reverse reverse
v-model='days' v-model='days'
) )
.body-2.mx-3 Day(s) .body-2.mx-3 {{$t('common:duration.days')}}
v-divider.mr-3() v-divider.mr-3()
v-text-field( v-text-field(
solo solo
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
reverse reverse
v-model='months' v-model='months'
) )
.body-2.mx-3 Month(s) .body-2.mx-3 {{$t('common:duration.months')}}
v-divider.mr-3() v-divider.mr-3()
v-text-field( v-text-field(
solo solo
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
reverse reverse
v-model='years' v-model='years'
) )
.body-2.mx-3 Year(s) .body-2.mx-3 {{$t('common:duration.years')}}
</template> </template>
<script> <script>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
) )
v-card.wiki-form v-card.wiki-form
.dialog-header .dialog-header
span Search User span {{$t('common:user.search')}}
v-spacer v-spacer
v-progress-circular( v-progress-circular(
indeterminate indeterminate
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
v-card-text v-card-text
v-text-field( v-text-field(
outline outline
label='Search Users...' :label='$t(`common:user.searchPlaceholder`)'
v-model='search' v-model='search'
prepend-inner-icon='search' prepend-inner-icon='search'
color='primary' color='primary'
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
flat flat
@click='close' @click='close'
:disabled='loading' :disabled='loading'
) Cancel ) {{$t('common:actions.cancel')}}
</template> </template>
<script> <script>
......
...@@ -86,6 +86,12 @@ ...@@ -86,6 +86,12 @@
v-btn.animated.fadeIn.wait-p11s(icon, slot='activator', @click='insertAfter({ content: `---`, newLine: true })').mx-0 v-btn.animated.fadeIn.wait-p11s(icon, slot='activator', @click='insertAfter({ content: `---`, newLine: true })').mx-0
v-icon remove v-icon remove
span Horizontal Bar span Horizontal Bar
template(v-if='$vuetify.breakpoint.mdAndUp')
v-spacer
v-tooltip(bottom, color='primary')
v-btn.animated.fadeIn.wait-p11s(icon, slot='activator', @click='previewShown = !previewShown').mx-0
v-icon flip
span Hide / Show Preview Pane
.editor-markdown-main .editor-markdown-main
.editor-markdown-sidebar .editor-markdown-sidebar
v-tooltip(right, color='teal') v-tooltip(right, color='teal')
...@@ -131,12 +137,9 @@ ...@@ -131,12 +137,9 @@
v-icon(:color='helpShown ? `teal` : ``') help v-icon(:color='helpShown ? `teal` : ``') help
span Markdown Formatting Help span Markdown Formatting Help
.editor-markdown-editor .editor-markdown-editor
.editor-markdown-editor-title(v-if='previewShown', @click='previewShown = false') Editor
.editor-markdown-editor-title(v-else='previewShown', @click='previewShown = true'): v-icon(dark) drag_indicator
codemirror(ref='cm', v-model='code', :options='cmOptions', @ready='onCmReady', @input='onCmInput') codemirror(ref='cm', v-model='code', :options='cmOptions', @ready='onCmReady', @input='onCmInput')
transition(name='editor-markdown-preview') transition(name='editor-markdown-preview')
.editor-markdown-preview(v-if='previewShown') .editor-markdown-preview(v-if='previewShown')
.editor-markdown-preview-title(@click='previewShown = false') Preview
.editor-markdown-preview-content.contents(ref='editorPreview', v-html='previewHTML') .editor-markdown-preview-content.contents(ref='editorPreview', v-html='previewHTML')
v-system-bar.editor-markdown-sysbar(dark, status, color='grey darken-3') v-system-bar.editor-markdown-sysbar(dark, status, color='grey darken-3')
...@@ -264,7 +267,9 @@ export default { ...@@ -264,7 +267,9 @@ export default {
highlightSelectionMatches: { highlightSelectionMatches: {
annotateScrollbar: true annotateScrollbar: true
}, },
viewportMargin: 50 viewportMargin: 50,
inputStyle: 'contenteditable',
allowDropFileTypes: ['image/jpg', 'image/png', 'image/svg', 'image/jpeg', 'image/gif']
}, },
cursorPos: { ch: 0, line: 1 }, cursorPos: { ch: 0, line: 1 },
previewShown: true, previewShown: true,
...@@ -339,6 +344,7 @@ export default { ...@@ -339,6 +344,7 @@ export default {
this.positionSync(cm) this.positionSync(cm)
this.scrollSync(cm) this.scrollSync(cm)
}) })
cm.on('paste', this.onCmPaste)
this.onCmInput(this.code) this.onCmInput(this.code)
}, },
onCmInput: _.debounce(function (newContent) { onCmInput: _.debounce(function (newContent) {
...@@ -351,6 +357,23 @@ export default { ...@@ -351,6 +357,23 @@ export default {
this.scrollSync(this.cm) this.scrollSync(this.cm)
}) })
}, 500), }, 500),
onCmPaste (cm, ev) {
const clipItems = (ev.clipboardData || ev.originalEvent.clipboardData).items
for (const clipItem of clipItems) {
if (_.startsWith(clipItem.type, 'image/')) {
const file = clipItem.getAsFile()
const reader = new FileReader()
reader.onload = evt => {
this.$store.commit(`loadingStart`, 'editor-paste-image')
this.insertAfter({
content: `![${file.name}](${evt.target.result})`,
newLine: true
})
}
reader.readAsDataURL(file)
}
}
},
/** /**
* Update cursor state * Update cursor state
*/ */
...@@ -514,28 +537,6 @@ $editor-height-mobile: calc(100vh - 112px - 16px); ...@@ -514,28 +537,6 @@ $editor-height-mobile: calc(100vh - 112px - 16px);
@include until($tablet) { @include until($tablet) {
height: $editor-height-mobile; height: $editor-height-mobile;
} }
&-title {
background-color: mc('grey', '800');
border-bottom-left-radius: 5px;
display: inline-flex;
height: 30px;
justify-content: center;
align-items: center;
padding: 0 1rem;
color: mc('grey', '500');
position: absolute;
top: 0;
right: 0;
z-index: 7;
text-transform: uppercase;
font-size: .7rem;
cursor: pointer;
@include until($tablet) {
display: none;
}
}
} }
&-preview { &-preview {
...@@ -582,24 +583,6 @@ $editor-height-mobile: calc(100vh - 112px - 16px); ...@@ -582,24 +583,6 @@ $editor-height-mobile: calc(100vh - 112px - 16px);
height: $editor-height-mobile; height: $editor-height-mobile;
} }
} }
&-title {
background-color: rgba(mc('blue', '100'), .75);
border-bottom-right-radius: 5px;
display: inline-flex;
height: 30px;
justify-content: center;
align-items: center;
padding: 0 1rem;
color: mc('blue', '800');
position: absolute;
top: 0;
left: 0;
z-index: 2;
text-transform: uppercase;
font-size: .7rem;
cursor: pointer;
}
} }
&-toolbar { &-toolbar {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
v-dialog(v-model='isShown', persistent, max-width='700') v-dialog(v-model='isShown', persistent, max-width='700')
v-card.radius-7(color='blue darken-3', dark) v-card.radius-7(color='blue darken-3', dark)
v-card-text.text-xs-center.py-4 v-card-text.text-xs-center.py-4
.subheading Which editor do you want to use for this page? .subheading {{$t('editor:select.title')}}
v-container(grid-list-lg, fluid) v-container(grid-list-lg, fluid)
v-layout(row, wrap, justify-center) v-layout(row, wrap, justify-center)
v-flex(xs4) v-flex(xs4)
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
img(src='/svg/icon-news.svg', alt='WikiText', style='width: 36px;') img(src='/svg/icon-news.svg', alt='WikiText', style='width: 36px;')
.body-2.grey--text.mt-2.text--darken-2 WikiText .body-2.grey--text.mt-2.text--darken-2 WikiText
.caption.grey--text.text--darken-1 MediaWiki Format .caption.grey--text.text--darken-1 MediaWiki Format
.caption.blue--text.text--lighten-2 This cannot be changed once the page is created. .caption.blue--text.text--lighten-2 {{$t('editor:select.cannotChange')}}
</template> </template>
<script> <script>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
) )
.dialog-header .dialog-header
v-icon(color='white') sort_by_alpha v-icon(color='white') sort_by_alpha
.subheading.white--text.ml-2 Page Properties .subheading.white--text.ml-2 {{$t('editor:props.pageProperties')}}
v-spacer v-spacer
v-btn.mx-0( v-btn.mx-0(
outline outline
...@@ -19,34 +19,34 @@ ...@@ -19,34 +19,34 @@
span {{ $t('common:actions.ok') }} span {{ $t('common:actions.ok') }}
v-card.wiki-form(tile) v-card.wiki-form(tile)
v-card-text v-card-text
v-subheader.pl-0 Page Info v-subheader.pl-0 {{$t('editor:props.pageInfo')}}
v-text-field( v-text-field(
ref='iptTitle' ref='iptTitle'
outline outline
background-color='grey lighten-2' background-color='grey lighten-2'
label='Title' :label='$t(`editor:props.title`)'
counter='255' counter='255'
v-model='title' v-model='title'
) )
v-text-field( v-text-field(
outline outline
background-color='grey lighten-2' background-color='grey lighten-2'
label='Short Description' :label='$t(`editor:props.shortDescription`)'
counter='255' counter='255'
v-model='description' v-model='description'
persistent-hint persistent-hint
hint='Shown below the title' :hint='$t(`editor:props.shortDescriptionHint`)'
) )
v-divider v-divider
v-card-text.grey(:class='darkMode ? `darken-3-d3` : `lighten-5`') v-card-text.grey(:class='darkMode ? `darken-3-d3` : `lighten-5`')
v-subheader.pl-0 Path &amp; Categorization v-subheader.pl-0 {{$t('editor:props.pathCategorization')}}
v-container.pa-0(fluid, grid-list-lg) v-container.pa-0(fluid, grid-list-lg)
v-layout(row, wrap) v-layout(row, wrap)
v-flex(xs12, md2) v-flex(xs12, md2)
v-select( v-select(
outline outline
background-color='grey lighten-2' background-color='grey lighten-2'
label='Locale' :label='$t(`editor:props.locale`)'
suffix='/' suffix='/'
:items='namespaces' :items='namespaces'
v-model='locale' v-model='locale'
...@@ -57,10 +57,10 @@ ...@@ -57,10 +57,10 @@
v-text-field( v-text-field(
outline outline
background-color='grey lighten-2' background-color='grey lighten-2'
label='Path' :label='$t(`editor:props.path`)'
append-icon='folder' append-icon='folder'
v-model='path' v-model='path'
hint='Do not include any leading or trailing slashes.' :hint='$t(`editor:props.pathHint`)'
persistent-hint persistent-hint
@click:append='showPathSelector' @click:append='showPathSelector'
:disabled='mode !== "create"' :disabled='mode !== "create"'
...@@ -69,25 +69,25 @@ ...@@ -69,25 +69,25 @@
background-color='grey lighten-2' background-color='grey lighten-2'
chips chips
deletable-chips deletable-chips
label='Tags' :label='$t(`editor:props.tags`)'
outline outline
multiple multiple
v-model='tags' v-model='tags'
single-line single-line
hint='Use tags to categorize your pages and make them easier to find.' :hint='$t(`editor:props.tagsHint`)'
persistent-hint persistent-hint
) )
v-divider v-divider
v-card-text.pb-5.grey(:class='darkMode ? `darken-3-d5` : `lighten-4`') v-card-text.pb-5.grey(:class='darkMode ? `darken-3-d5` : `lighten-4`')
v-subheader.pl-0 Publishing State v-subheader.pl-0 {{$t('editor:props.publishState')}}
v-container.pa-0(fluid, grid-list-lg) v-container.pa-0(fluid, grid-list-lg)
v-layout(row, wrap) v-layout(row, wrap)
v-flex(xs12, md4) v-flex(xs12, md4)
v-switch( v-switch(
label='Published' :label='$t(`editor:props.publishToggle`)'
v-model='isPublished' v-model='isPublished'
color='primary' color='primary'
hint='Unpublished pages can still be seen by users having write permissions on this page.' :hint='$t(`editor:props.publishToggleHint`)'
persistent-hint persistent-hint
) )
v-flex(xs12, md4) v-flex(xs12, md4)
...@@ -103,14 +103,14 @@ ...@@ -103,14 +103,14 @@
) )
v-text-field( v-text-field(
slot='activator' slot='activator'
label='Publish starting on...' :label='$t(`editor:props.publishStart`)'
v-model='publishStartDate' v-model='publishStartDate'
prepend-icon='event' prepend-icon='event'
readonly readonly
outline outline
background-color='grey lighten-2' background-color='grey lighten-2'
clearable clearable
hint='Leave empty for no start date' :hint='$t(`editor:props.publishStartHint`)'
persistent-hint persistent-hint
:disabled='!isPublished' :disabled='!isPublished'
) )
...@@ -127,12 +127,12 @@ ...@@ -127,12 +127,12 @@
flat='' flat=''
color='primary' color='primary'
@click='isPublishStartShown = false' @click='isPublishStartShown = false'
) Cancel ) {{$t('common:actions.cancel')}}
v-btn( v-btn(
flat='' flat=''
color='primary' color='primary'
@click='$refs.menuPublishStart.save(publishStartDate)' @click='$refs.menuPublishStart.save(publishStartDate)'
) OK ) {{$t('common:actions.ok')}}
v-flex(xs12, md4) v-flex(xs12, md4)
v-dialog( v-dialog(
ref='menuPublishEnd' ref='menuPublishEnd'
...@@ -146,14 +146,14 @@ ...@@ -146,14 +146,14 @@
) )
v-text-field( v-text-field(
slot='activator' slot='activator'
label='Publish ending on...' :label='$t(`editor:props.publishEnd`)'
v-model='publishEndDate' v-model='publishEndDate'
prepend-icon='event' prepend-icon='event'
readonly readonly
outline outline
background-color='grey lighten-2' background-color='grey lighten-2'
clearable clearable
hint='Leave empty for no end date' :hint='$t(`editor:props.publishEndHint`)'
persistent-hint persistent-hint
:disabled='!isPublished' :disabled='!isPublished'
) )
...@@ -170,12 +170,12 @@ ...@@ -170,12 +170,12 @@
flat='' flat=''
color='primary' color='primary'
@click='isPublishEndShown = false' @click='isPublishEndShown = false'
) Cancel ) {{$t('common:actions.cancel')}}
v-btn( v-btn(
flat='' flat=''
color='primary' color='primary'
@click='$refs.menuPublishEnd.save(publishEndDate)' @click='$refs.menuPublishEnd.save(publishEndDate)'
) OK ) {{$t('common:actions.ok')}}
page-selector(mode='create', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath') page-selector(mode='create', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath')
v-tour(name='editorPropertiesTour', :steps='tourSteps') v-tour(name='editorPropertiesTour', :steps='tourSteps')
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
v-card.wiki-form v-card.wiki-form
.dialog-header.is-short.is-red .dialog-header.is-short.is-red
v-icon.mr-2(color='white') warning v-icon.mr-2(color='white') warning
span Discard Unsaved Changes? span {{$t('editor:unsaved.title')}}
v-card-text v-card-text
.body-2 You have unsaved changes. Are you sure you want to leave the editor and discard any modifications you made since the last save? .body-2 {{$t('editor:unsaved.body')}}
v-card-chin v-card-chin
v-spacer v-spacer
v-btn(flat, @click='isShown = false') Cancel v-btn(flat, @click='isShown = false') {{$t('common:actions.cancel')}}
v-btn(color='red', @click='discard', dark) Discard Changes v-btn(color='red', @click='discard', dark) {{$t('common:actions.discardChanges')}}
</template> </template>
<script> <script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment