Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Remove "Allow Source Mode" option from Bard #11227

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

1 change: 0 additions & 1 deletion resources/lang/ar/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'سيكون هذا الحقل متاحًا بمجرد تعيين :field .',
'assets.dynamic_folder_pending_save' => 'سيكون هذا المجال متاحًا بعد الحفظ.',
'assets.title' => 'أصول',
'bard.config.allow_source' => 'تمكين عرض كود HTML المصدر أثناء الكتابة.',
'bard.config.always_show_set_button' => 'تمكين عرض زر "إضافة مجموعة" دائمًا.',
'bard.config.buttons' => 'اختر الأزرار التي تظهر في شريط الأدوات.',
'bard.config.container' => 'اختر حاوية الأصول التي تريد استخدامها لهذا الحقل.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/az/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Bu sahə bir dəfə əlçatan olacaq :field təyin olundu.',
'assets.dynamic_folder_pending_save' => 'Bu sahə yadda saxladıqdan sonra əlçatan olacaq.',
'assets.title' => 'Varlıqlar',
'bard.config.allow_source' => 'Yazarkən HTML mənbə kodunu görməyə imkan ver.',
'bard.config.always_show_set_button' => '“Set Ekle” düyməsini həmişə göstərmək üçün aktivləşdirin.',
'bard.config.buttons' => 'Alət çubuğunda hansı düymələrin göstəriləcəyini seçin.',
'bard.config.container' => 'Bu sahə üçün hansı varlıq konteynerinin istifadə olunacağını seçin.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/cs/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Toto pole bude dostupné, jakmile bude nastaveno :field .',
'assets.dynamic_folder_pending_save' => 'Toto pole bude dostupné po uložení.',
'assets.title' => 'Soubory',
'bard.config.allow_source' => 'Umožňuje zobrazení zdrojového kódu HTML při zápisu.',
'bard.config.always_show_set_button' => 'Umožňuje trvalé zobrazení tlačítka "Přidat sadu".',
'bard.config.buttons' => 'Vyberte, která tlačítka se mají zobrazit na panelu nástrojů.',
'bard.config.container' => 'Pro toto pole vyberte kontejner souboru.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/da/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Dette felt vil være tilgængeligt, når :field er indstillet.',
'assets.dynamic_folder_pending_save' => 'Dette felt vil være tilgængeligt efter lagring.',
'assets.title' => 'Assets',
'bard.config.allow_source' => 'Aktiver for at få vist HTML-kildekoden under skrivning.',
'bard.config.always_show_set_button' => 'Aktiver for altid at vise knappen "Tilføj sæt".',
'bard.config.buttons' => 'Vælg hvilke knapper der skal vises på værktøjslinjen.',
'bard.config.container' => 'Vælg hvilken aktiv-beholder, der skal bruges til dette felt.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/de/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Dieses Feld ist verfügbar, sobald :field festgelegt ist.',
'assets.dynamic_folder_pending_save' => 'Dieses Feld ist nach dem Speichern verfügbar.',
'assets.title' => 'Dateien',
'bard.config.allow_source' => 'Ermöglicht beim Schreiben das Anzeigen des HTML-Quellcodes.',
'bard.config.always_show_set_button' => 'Ermöglicht das ständige Anzeigen des „Set hinzufügen“-Buttons.',
'bard.config.buttons' => 'Auswählen, welche Buttons in der Symbolleiste angezeigt werden sollen.',
'bard.config.container' => 'Datei-Container für dieses Feld auswählen.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/de_CH/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Dieses Feld ist verfügbar, sobald :field festgelegt ist.',
'assets.dynamic_folder_pending_save' => 'Dieses Feld ist nach dem Speichern verfügbar.',
'assets.title' => 'Dateien',
'bard.config.allow_source' => 'Ermöglicht beim Schreiben das Anzeigen des HTML-Quellcodes.',
'bard.config.always_show_set_button' => 'Ermöglicht das ständige Anzeigen des «Set hinzufügen»-Buttons.',
'bard.config.buttons' => 'Auswählen, welche Buttons in der Symbolleiste angezeigt werden sollen.',
'bard.config.container' => 'Datei-Container für dieses Feld auswählen.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/en/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
'assets.dynamic_folder_pending_save' => 'This field will be available after saving.',
'assets.title' => 'Assets',
'asset_folders.config.container' => 'Choose which asset container to use for this field.',
'bard.config.allow_source' => 'Enable to view the HTML source code while writing.',
'bard.config.always_show_set_button' => 'Enable to always show the "Add Set" button.',
'bard.config.buttons' => 'Choose which buttons to show in the toolbar.',
'bard.config.container' => 'Choose which asset container to use for this field.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/es/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Este campo estará disponible una vez que se configure :field .',
'assets.dynamic_folder_pending_save' => 'Este campo estará disponible después de guardar.',
'assets.title' => 'Assets',
'bard.config.allow_source' => 'Activa la opción para ver el código fuente HTML mientras escribes.',
'bard.config.always_show_set_button' => 'Habilita para mostrar siempre el botón "Agregar conjunto".',
'bard.config.buttons' => 'Elige qué botones mostrar en la barra de herramientas.',
'bard.config.container' => 'Elige qué contenedor de medios usar para este campo.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/fa/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'پس از تنظیم :field این فیلد در دسترس خواهد بود.',
'assets.dynamic_folder_pending_save' => 'این فیلد پس از ذخیره در دسترس خواهد بود.',
'assets.title' => 'فایل',
'bard.config.allow_source' => 'امکان مشاهده‌ی سورس محتوا (HTML) را فعال سازید.',
'bard.config.always_show_set_button' => 'همواره دکمه‌ی "افزودن مجموعه" نمایان باشد.',
'bard.config.buttons' => 'مشخص کنید کدامین دکمه‌ها در نوار ابزار نمایان باشند.',
'bard.config.container' => 'کانتینر فایل مورد استفاده برای این فیلد را مشخص کنید.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/fr/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
'assets.dynamic_folder_pending_field' => 'Ce champ sera disponible dès que :field sera défini.',
'assets.dynamic_folder_pending_save' => 'Ce champ sera disponible après enregistrement.',
'assets.title' => 'Assets',
'bard.config.allow_source' => 'Activez l’option pour afficher le code source HTML pendant l’écriture.',
'bard.config.always_show_set_button' => 'Activez l’option pour toujours afficher le bouton "Ajouter un ensemble".',
'bard.config.buttons' => 'Choisissez les boutons à afficher dans la barre d’outils.',
'bard.config.container' => 'Choisissez quel conteneur de ressources à utiliser pour ce champ.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/hu/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Ez a mező akkor lesz elérhető, ha :field be van állítva.',
'assets.dynamic_folder_pending_save' => 'Ez a mező a mentés után lesz elérhető.',
'assets.title' => 'Fájlok',
'bard.config.allow_source' => 'Engedélyezze a HTML forráskód megtekintését írás közben.',
'bard.config.always_show_set_button' => 'Engedélyezze, hogy mindig megjelenjen a „Szett hozzáadása” gomb.',
'bard.config.buttons' => 'Válassza ki, hogy mely gombok jelenjenek meg az eszköztárban.',
'bard.config.container' => 'Válassza ki, hogy melyik Médiatároló kerüljön használatra ennél a mezőnél.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/id/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Bidang ini akan tersedia setelah :field ditetapkan.',
'assets.dynamic_folder_pending_save' => 'Kolom ini akan tersedia setelah disimpan.',
'assets.title' => 'Assets',
'bard.config.allow_source' => 'Aktifkan untuk melihat kode sumber HTML saat menulis.',
'bard.config.always_show_set_button' => 'Aktifkan untuk selalu menampilkan tombol "Tambahkan Set".',
'bard.config.buttons' => 'Pilih tombol mana yang akan ditampilkan di toolbar.',
'bard.config.container' => 'Pilih penampung aset mana yang akan digunakan untuk bidang ini.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/it/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
'assets.dynamic_folder_pending_field' => 'Questo campo sarà disponibile una volta che :field sarà impostato.',
'assets.dynamic_folder_pending_save' => 'Questo campo sarà disponibile dopo il salvataggio.',
'assets.title' => 'Assets',
'bard.config.allow_source' => 'Abilita la visualizzazione del codice sorgente HTML durante la scrittura.',
'bard.config.always_show_set_button' => 'Abilita la visualizzazione permanente del pulsante "Aggiungi set".',
'bard.config.buttons' => 'Scegli i pulsanti da mostrare nella barra degli strumenti.',
'bard.config.container' => 'Scegli quale contenitore dei media utilizzare per questo campo.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/ja/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'このフィールドは:fieldが設定されると使用可能になります。',
'assets.dynamic_folder_pending_save' => 'このフィールドは保存後に使用可能になります。',
'assets.title' => '資産',
'bard.config.allow_source' => '書き込み中に HTML ソース コードを表示できるようにします。',
'bard.config.always_show_set_button' => '有効にすると、「セット追加」ボタンが常に表示されます。',
'bard.config.buttons' => 'ツールバーに表示するボタンを選択します。',
'bard.config.container' => 'このフィールドに使用するアセット コンテナを選択します。',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/ms/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Medan ini akan tersedia setelah :field ditetapkan.',
'assets.dynamic_folder_pending_save' => 'Medan ini akan tersedia selepas disimpan.',
'assets.title' => 'Aset',
'bard.config.allow_source' => 'Dayakan untuk melihat kod sumber HTML semasa menulis.',
'bard.config.always_show_set_button' => 'Dayakan untuk sentiasa menunjukkan butang "Tambah Set".',
'bard.config.buttons' => 'Pilih butang yang hendak ditunjukkan dalam bar alat.',
'bard.config.container' => 'Pilih penampung aset yang hendak digunakan untuk bidang ini.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/nb/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Dette feltet vil være tilgjengelig når :field er satt.',
'assets.dynamic_folder_pending_save' => 'Dette feltet vil være tilgjengelig etter lagring.',
'assets.title' => 'Filer',
'bard.config.allow_source' => 'Aktiver for å vise HTML-kildekoden under skriving.',
'bard.config.always_show_set_button' => 'Aktiver for alltid å vise knappen "Legg til sett".',
'bard.config.buttons' => 'Velg knappene som skal vises på verktøylinjen.',
'bard.config.container' => 'Velg filbeholderen som skal brukes for dette feltet.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/nl/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Dit veld is beschikbaar zodra :field is ingesteld.',
'assets.dynamic_folder_pending_save' => 'Dit veld is beschikbaar na het opslaan.',
'assets.title' => 'Assets',
'bard.config.allow_source' => 'Schakel de optie in dat gebruikers de HTML-broncode kunnen bekijken tijdens het schrijven.',
'bard.config.always_show_set_button' => 'Schakel in om altijd de voeg-set-knop-toe te tonen.',
'bard.config.buttons' => 'Kies welke knoppen er in de toolbar zitten.',
'bard.config.container' => 'Kies welke asset-container er voor dit veld gebruikt moet worden.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/pl/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'To pole będzie dostępne po ustawieniu opcji :field .',
'assets.dynamic_folder_pending_save' => 'To pole będzie dostępne po zapisaniu.',
'assets.title' => 'Zasoby',
'bard.config.allow_source' => 'Włącz, aby móc zobaczyć kod źródłowy HTML podczas pisania.',
'bard.config.always_show_set_button' => 'Włącz, aby zawsze pokazywać przycisk &quot;Dodaj zestaw&quot;.',
'bard.config.buttons' => 'Wybierz, które przyciski pokazać na pasku narzędzi.',
'bard.config.container' => 'Wybierz, który kontener zasobów użyć dla tego pola.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/pt/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Este campo estará disponível quando :field for definido.',
'assets.dynamic_folder_pending_save' => 'Este campo estará disponível após salvar.',
'assets.title' => 'Assets',
'bard.config.allow_source' => 'Habilitar a opção de visualizar o código fonte HTML enquanto escreve',
'bard.config.always_show_set_button' => 'Permitir mostrar sempre o botão "Adicionar Set".',
'bard.config.buttons' => 'Escolha quais os botões a mostrar na barra de ferramentas.',
'bard.config.container' => 'Escolha qual o contentor de activos a utilizar para este campo.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/pt_BR/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Este campo estará disponível quando :field for definido.',
'assets.dynamic_folder_pending_save' => 'Este campo estará disponível após salvar.',
'assets.title' => 'Ativos',
'bard.config.allow_source' => 'Habilite a visualização do código-fonte HTML durante a escrita.',
'bard.config.always_show_set_button' => 'Ative para sempre mostrar o botão &quot;Adicionar conjunto&quot;.',
'bard.config.buttons' => 'Escolha quais botões mostrar na barra de ferramentas.',
'bard.config.container' => 'Escolha qual contêiner de ativos usar para este campo.',
Expand Down
1 change: 0 additions & 1 deletion resources/lang/ru/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'assets.dynamic_folder_pending_field' => 'Это поле будет доступно после установки :field .',
'assets.dynamic_folder_pending_save' => 'Это поле будет доступно после сохранения.',
'assets.title' => 'Ресурсы',
'bard.config.allow_source' => 'Включите для просмотра исходного кода HTML во время записи.',
'bard.config.always_show_set_button' => 'Включите для постоянного отображения кнопки «Добавить набор».',
'bard.config.buttons' => 'Выберите, какие кнопки отображаются на панели инструментов.',
'bard.config.container' => 'Выберите, какой контейнер ресурсов использовать для этого поля.',
Expand Down
Loading
Loading