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

✨ feat: WP Editor light theme #1172

Merged
merged 1 commit into from
Oct 1, 2024
Merged
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
1 change: 1 addition & 0 deletions assets/lib/tinymce/light/content.inline.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/lib/tinymce/light/content.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/lib/tinymce/light/skin.min.css

Large diffs are not rendered by default.

41 changes: 14 additions & 27 deletions assets/react/v3/shared/atoms/WPEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,34 @@ function editorConfig(
remove_script_host: 0,
plugins:
'charmap,colorpicker,hr,lists,image,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview',
skin: 'lightgray',
skin: 'light',
skin_url: '/wp-content/plugins/tutor/assets/lib/tinymce/light',
submit_patch: true,
link_context_toolbar: false,
theme: 'modern',
toolbar: !readOnly,
toolbar1: isMinimal
? `bold,italic,underline,image${isTutorPro ? ',codesample' : ''}`
: `formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_more,fullscreen,wp_adv,tutor_button${
isTutorPro ? ',codesample' : ''
}`,

toolbar2: 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
content_css: '/wp-includes/css/dashicons.min.css,/wp-includes/js/tinymce/skins/wordpress/wp-content.css',
content_style: 'body { font-family: "SF Pro Display, sans-serif; font-size: 14px; }',
? `bold italic underline | image | ${isTutorPro ? 'codesample' : ''}`
: `formatselect | bold italic underline | bullist numlist | blockquote | alignleft aligncenter alignright | link unlink | wp_more ${
isTutorPro ? ' codesample' : ''
} | wp_adv`,

toolbar2:
'strikethrough hr | forecolor pastetext removeformat | charmap | outdent indent | undo redo | wp_help | fullscreen | tutor_button | undoRedoDropdown',
content_css:
'/wp-includes/css/dashicons.min.css,/wp-includes/js/tinymce/skins/wordpress/wp-content.css, /wp-content/plugins/tutor/assets/lib/tinymce/light/content.min.css',

statusbar: !readOnly,
branding: false,
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
setup: (editor: any) => {
editor.on('init', () => {
if (readOnly) {
editor.setMode('readonly');

const editorBody = editor.contentDocument.querySelector('.mce-content-body');
editorBody.style.backgroundColor = 'transparent';

setTimeout(() => {
const height = editorBody.scrollHeight;
editor.iframeElement.style.height = `${height}px`;
Expand Down Expand Up @@ -302,11 +305,9 @@ const styles = {
}

.wp-editor-container {
border-color: ${colorTokens.stroke.default};
border-top-left-radius: ${borderRadius[6]};
border-bottom-left-radius: ${borderRadius[6]};
border-bottom-right-radius: ${borderRadius[6]};
background-color: ${colorTokens.background.white};

${
isFocused &&
Expand All @@ -323,20 +324,11 @@ const styles = {
.wp-switch-editor {
border-top-left-radius: ${borderRadius[4]};
border-top-right-radius: ${borderRadius[4]};
border-color: ${colorTokens.stroke.default};
background-color: ${colorTokens.background.default};
}

.html-active .switch-html,
.tmce-active .switch-tmce {
border-bottom-color: ${colorTokens.background.default};
}

.mce-toolbar-grp,
.quicktags-toolbar {
border-top-left-radius: ${borderRadius[6]};
background-color: ${colorTokens.background.default};
border-color: ${colorTokens.stroke.default};

${
isMinimal &&
Expand All @@ -351,7 +343,6 @@ const styles = {
}

.mce-statusbar {
border-color: ${colorTokens.stroke.default};
border-bottom-left-radius: ${borderRadius[6]};
border-bottom-right-radius: ${borderRadius[6]};
}
Expand Down Expand Up @@ -389,9 +380,5 @@ const styles = {
border: none;
outline: none;
}

.mce-active {
background: #555c66 !important;
}
`,
};
Loading