Skip to content

Commit

Permalink
Bard: Remove "Allow Source Mode" option
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Dec 6, 2024
1 parent ed9161d commit bb66910
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 95 deletions.
36 changes: 5 additions & 31 deletions resources/js/components/fieldtypes/bard/BardFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
:config="config"
:bard="_self"
:editor="editor" />
<button class="bard-toolbar-button" @click="showSource = !showSource" v-if="allowSource" v-tooltip="__('Show HTML Source')" :aria-label="__('Show HTML Source')">
<svg-icon name="show-source" class="w-4 h-4 "/>
</button>
</div>
</div>
</publish-field-fullscreen-header>
Expand All @@ -49,9 +46,6 @@
:config="config"
:bard="_self"
:editor="editor" />
<button class="bard-toolbar-button" @click="showSource = !showSource" v-if="allowSource" v-tooltip="__('Show HTML Source')" :aria-label="__('Show HTML Source')">
<svg-icon name="show-source" class="w-4 h-4 "/>
</button>
</div>
</div>

Expand Down Expand Up @@ -100,8 +94,7 @@
</floating-menu>

<div class="bard-error" v-if="initError" v-html="initError"></div>
<editor-content :editor="editor" v-show="!showSource" :id="fieldId" />
<bard-source :html="htmlWithReplacedLinks" v-if="showSource" />
<editor-content :editor="editor" :id="fieldId" />
</div>
<div class="bard-footer-toolbar" v-if="editor && (config.reading_time || config.character_limit || config.word_count)">
<div v-if="config.reading_time">{{ readingTime }} {{ __('Reading Time') }}</div>
Expand Down Expand Up @@ -149,7 +142,6 @@ import Text from '@tiptap/extension-text';
import TextAlign from '@tiptap/extension-text-align';
import Typography from '@tiptap/extension-typography';
import Underline from '@tiptap/extension-underline';
import BardSource from './Source.vue';
import SetPicker from '../replicator/SetPicker.vue';
import { DocumentBlock, DocumentInline } from './Document';
import { Set } from './Set'
Expand All @@ -169,7 +161,6 @@ export default {
components: {
BubbleMenu,
BardSource,
BardToolbarButton,
SetPicker,
EditorContent,
Expand All @@ -184,7 +175,6 @@ export default {
editor: null,
html: null,
json: [],
showSource: false,
fullScreenMode: false,
buttons: [],
collapsed: this.meta.collapsed,
Expand All @@ -204,10 +194,6 @@ export default {
computed: {
allowSource() {
return this.config.allow_source === undefined ? true : this.config.allow_source;
},
toolbarIsFixed() {
return this.config.toolbar_mode === 'fixed';
},
Expand All @@ -217,11 +203,11 @@ export default {
},
showFixedToolbar() {
return this.toolbarIsFixed && (this.visibleButtons.length > 0 || this.allowSource || this.hasExtraButtons)
return this.toolbarIsFixed && (this.visibleButtons.length > 0 || this.hasExtraButtons)
},
hasExtraButtons() {
return this.allowSource || this.setConfigs.length > 0 || this.config.fullscreen;
return this.setConfigs.length > 0 || this.config.fullscreen;
},
readingTime() {
Expand Down Expand Up @@ -281,18 +267,6 @@ export default {
return this.storeState ? this.storeState.site : this.$config.get('selectedSite');
},
htmlWithReplacedLinks() {
return this.html.replaceAll(/\"statamic:\/\/(.*?)\"/g, (match, ref) => {
const linkData = this.meta.linkData[ref];
if (! linkData) {
this.$toast.error(`${__('No link data found for')} ${ref}`);
return '""';
}
return `"${linkData.permalink}"`;
});
},
setsWithErrors() {
if (! this.storeState) return [];
Expand Down Expand Up @@ -410,13 +384,13 @@ export default {
json(json, oldJson) {
if (!this.mounted) return;
if (json === oldJson) return;
this.updateDebounced(json);
},
value(value, oldValue) {
value(value, oldValue) {
const oldContent = this.editor.getJSON();
const content = this.valueToContent(value);
Expand Down
58 changes: 0 additions & 58 deletions resources/js/components/fieldtypes/bard/Source.vue

This file was deleted.

6 changes: 0 additions & 6 deletions src/Fieldtypes/Bard.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,6 @@ protected function configFieldItems(): array
'type' => 'toggle',
'default' => true,
],
'allow_source' => [
'display' => __('Allow Source Mode'),
'instructions' => __('statamic::fieldtypes.bard.config.allow_source'),
'type' => 'toggle',
'default' => true,
],
'enable_input_rules' => [
'display' => __('Enable Input Rules'),
'instructions' => __('statamic::fieldtypes.bard.config.enable_input_rules'),
Expand Down

0 comments on commit bb66910

Please sign in to comment.