Skip to content

Commit

Permalink
Base layout: Changed main app script to be module loaded
Browse files Browse the repository at this point in the history
Prevents polluting global scope with variables since we're using the
module format bundler in esbuild.
Also cleaned up unused yields.
Fixed bad reference in our tinymce fixes.

For #5232
  • Loading branch information
ssddanbrown committed Oct 1, 2024
1 parent e656555 commit 34ade50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
8 changes: 5 additions & 3 deletions resources/js/wysiwyg-tinymce/fixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ export function handleTableCellRangeEvents(editor) {
cell.removeAttribute('align');
cleanChildAlignment(cell);
},
JustifyRight: this.JustifyLeft,
JustifyCenter: this.JustifyLeft,
JustifyFull: this.JustifyLeft,
};

// Copy justify left action to other alignment actions
actionByCommand.JustifyRight = actionByCommand.JustifyLeft;
actionByCommand.JustifyCenter = actionByCommand.JustifyLeft;
actionByCommand.JustifyFull = actionByCommand.JustifyLeft;

editor.on('ExecCommand', event => {
const action = actionByCommand[event.command];
if (action) {
Expand Down
6 changes: 2 additions & 4 deletions resources/views/comments/comments.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ class="button outline">{{ trans('entities.comment_add') }}</button>
@endif

@if(userCan('comment-create-all') || $commentTree->canUpdateAny())
@push('post-app-scripts')
<script src="{{ versioned_asset('libs/tinymce/tinymce.min.js') }}" nonce="{{ $cspNonce }}"></script>
@push('body-end')
<script src="{{ versioned_asset('libs/tinymce/tinymce.min.js') }}" nonce="{{ $cspNonce }}" defer></script>
@include('form.editor-translations')
@endpush
@push('post-app-html')
@include('entities.selector-popup')
@endpush
@endif
Expand Down
10 changes: 2 additions & 8 deletions resources/views/layouts/base.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class="{{ setting()->getForCurrentUser('dark-mode-enabled') ? 'dark-mode ' : ''
<!-- OpenSearch -->
<link rel="search" type="application/opensearchdescription+xml" title="{{ setting('app-name') }}" href="{{ url('/opensearch.xml') }}">

@yield('head')

<!-- Custom Styles & Head Content -->
@include('layouts.parts.custom-styles')
@include('layouts.parts.custom-head')
Expand Down Expand Up @@ -70,14 +68,10 @@ class="@stack('body-class')">
</div>
</div>

@yield('bottom')
@stack('post-app-html')

@if($cspNonce ?? false)
<script src="{{ versioned_asset('dist/app.js') }}" nonce="{{ $cspNonce }}"></script>
<script src="{{ versioned_asset('dist/app.js') }}" type="module" nonce="{{ $cspNonce }}"></script>
@endif
@yield('scripts')
@stack('post-app-scripts')
@stack('body-end')

@include('layouts.parts.base-body-end')
</body>
Expand Down

0 comments on commit 34ade50

Please sign in to comment.