@wordpress/edit-site 3.0.24 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/LICENSE.md +1 -1
- package/README.md +7 -1
- package/build/components/block-editor/resizable-editor.js +1 -0
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/code-editor/code-editor-text-area.js +95 -0
- package/build/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build/components/code-editor/index.js +79 -0
- package/build/components/code-editor/index.js.map +1 -0
- package/build/components/editor/index.js +39 -9
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +81 -22
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +1 -0
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/header.js +2 -7
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +35 -12
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -3
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +46 -15
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +9 -12
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -3
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +0 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +0 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +5 -6
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +0 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +6 -12
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +22 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +138 -0
- package/build/components/global-styles/screen-style-variations.js.map +1 -0
- package/build/components/global-styles/screen-text-color.js +6 -12
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -2
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -3
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +31 -14
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header/index.js +12 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +78 -0
- package/build/components/header/mode-switcher/index.js.map +1 -0
- package/build/components/header/more-menu/copy-content-menu-item.js +74 -0
- package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/header/more-menu/index.js +72 -39
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/build/components/header/more-menu/site-export.js.map +1 -0
- package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/header/tools-more-menu-group/index.js +1 -5
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +26 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -4
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +3 -3
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/list/added-by.js +51 -50
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/routes/redirect-to-homepage.js +87 -0
- package/build/components/routes/redirect-to-homepage.js.map +1 -0
- package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/default-sidebar.js +4 -2
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +1 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -38
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +10 -5
- package/build/index.js.map +1 -1
- package/build/store/actions.js +29 -27
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +11 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +1 -0
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/code-editor/code-editor-text-area.js +83 -0
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build-module/components/code-editor/index.js +62 -0
- package/build-module/components/code-editor/index.js.map +1 -0
- package/build-module/components/editor/index.js +38 -10
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +82 -23
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +1 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +1 -1
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +35 -10
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +2 -2
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +45 -15
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +9 -13
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +1 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +0 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +0 -2
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +2 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +0 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +7 -13
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +21 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +119 -0
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -0
- package/build-module/components/global-styles/screen-text-color.js +7 -13
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -2
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +1 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +29 -14
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header/index.js +13 -5
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +65 -0
- package/build-module/components/header/mode-switcher/index.js.map +1 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js +59 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/header/more-menu/index.js +67 -40
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/build-module/components/header/more-menu/site-export.js.map +1 -0
- package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/header/tools-more-menu-group/index.js +2 -5
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +26 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +5 -4
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +3 -3
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/list/added-by.js +52 -51
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/routes/redirect-to-homepage.js +75 -0
- package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/default-sidebar.js +4 -2
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +1 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +3 -40
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +9 -4
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +25 -25
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +11 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +202 -72
- package/build-style/style.css +202 -72
- package/package.json +28 -30
- package/src/components/block-editor/resizable-editor.js +1 -0
- package/src/components/block-editor/style.scss +15 -23
- package/src/components/code-editor/code-editor-text-area.js +79 -0
- package/src/components/code-editor/index.js +65 -0
- package/src/components/code-editor/style.scss +100 -0
- package/src/components/editor/index.js +55 -10
- package/src/components/global-styles/border-panel.js +106 -42
- package/src/components/global-styles/context-menu.js +1 -1
- package/src/components/global-styles/global-styles-provider.js +1 -2
- package/src/components/global-styles/header.js +3 -5
- package/src/components/global-styles/navigation-button.js +31 -10
- package/src/components/global-styles/palette.js +6 -2
- package/src/components/global-styles/preview.js +46 -18
- package/src/components/global-styles/screen-background-color.js +7 -12
- package/src/components/global-styles/screen-block-list.js +1 -2
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-color-palette.js +0 -2
- package/src/components/global-styles/screen-colors.js +2 -3
- package/src/components/global-styles/screen-layout.js +1 -5
- package/src/components/global-styles/screen-link-color.js +6 -16
- package/src/components/global-styles/screen-root.js +32 -3
- package/src/components/global-styles/screen-style-variations.js +130 -0
- package/src/components/global-styles/screen-text-color.js +6 -16
- package/src/components/global-styles/screen-typography-element.js +0 -4
- package/src/components/global-styles/screen-typography.js +2 -3
- package/src/components/global-styles/style.scss +24 -25
- package/src/components/global-styles/ui.js +55 -25
- package/src/components/header/document-actions/style.scss +1 -9
- package/src/components/header/index.js +10 -2
- package/src/components/header/mode-switcher/index.js +67 -0
- package/src/components/header/more-menu/copy-content-menu-item.js +53 -0
- package/src/components/header/more-menu/index.js +107 -44
- package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/src/components/header/style.scss +2 -1
- package/src/components/header/tools-more-menu-group/index.js +2 -7
- package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
- package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
- package/src/components/keyboard-shortcuts/index.js +27 -1
- package/src/components/list/actions/index.js +5 -4
- package/src/components/list/actions/rename-menu-item.js +3 -3
- package/src/components/list/added-by.js +57 -63
- package/src/components/routes/redirect-to-homepage.js +71 -0
- package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
- package/src/components/secondary-sidebar/style.scss +0 -4
- package/src/components/sidebar/default-sidebar.js +2 -0
- package/src/components/sidebar/global-styles-sidebar.js +1 -0
- package/src/components/sidebar/style.scss +21 -14
- package/src/components/url-query-controller/index.js +3 -35
- package/src/index.js +10 -3
- package/src/store/actions.js +24 -37
- package/src/store/defaults.js +1 -0
- package/src/store/reducer.js +6 -0
- package/src/store/selectors.js +11 -0
- package/src/store/test/actions.js +2 -92
- package/src/style.scss +2 -0
- package/build/plugins/index.js +0 -28
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/site-export.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item.js.map +0 -1
- package/build-module/plugins/index.js +0 -20
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/site-export.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
- package/src/plugins/index.js +0 -24
package/build-style/style.css
CHANGED
|
@@ -470,9 +470,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
470
470
|
.edit-site-visual-editor.is-focus-mode .components-resizable-box__container {
|
|
471
471
|
overflow: visible;
|
|
472
472
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
.edit-site-visual-editor .components-resizable-box__container {
|
|
474
|
+
margin: 0 auto;
|
|
475
|
+
overflow: auto;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
.edit-site-visual-editor__back-button {
|
|
@@ -485,58 +485,144 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
485
485
|
color: #f0f0f0;
|
|
486
486
|
}
|
|
487
487
|
|
|
488
|
-
.components-resizable-box__container {
|
|
489
|
-
margin: 0 auto;
|
|
490
|
-
overflow: auto;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
488
|
.resizable-editor__drag-handle {
|
|
494
489
|
position: absolute;
|
|
495
490
|
top: 0;
|
|
496
491
|
bottom: 0;
|
|
497
492
|
padding: 0;
|
|
498
493
|
margin: auto 0;
|
|
499
|
-
width:
|
|
494
|
+
width: 4px;
|
|
500
495
|
height: 100px;
|
|
501
496
|
-webkit-appearance: none;
|
|
502
497
|
appearance: none;
|
|
503
|
-
cursor:
|
|
498
|
+
cursor: ew-resize;
|
|
504
499
|
outline: none;
|
|
505
|
-
background: #
|
|
506
|
-
border-radius:
|
|
500
|
+
background: #949494;
|
|
501
|
+
border-radius: 2px;
|
|
507
502
|
border: 0;
|
|
508
503
|
}
|
|
509
504
|
.resizable-editor__drag-handle.is-left {
|
|
510
|
-
left: -
|
|
505
|
+
left: -16px;
|
|
511
506
|
}
|
|
512
507
|
.resizable-editor__drag-handle.is-right {
|
|
513
|
-
right: -
|
|
508
|
+
right: -16px;
|
|
514
509
|
}
|
|
515
|
-
.resizable-editor__drag-handle:hover {
|
|
516
|
-
background: #
|
|
517
|
-
}
|
|
518
|
-
.resizable-editor__drag-handle:active {
|
|
519
|
-
cursor: grabbing;
|
|
520
|
-
background: #949494;
|
|
510
|
+
.resizable-editor__drag-handle:hover, .resizable-editor__drag-handle:active {
|
|
511
|
+
background: #ccc;
|
|
521
512
|
}
|
|
522
513
|
.resizable-editor__drag-handle:focus {
|
|
523
514
|
box-shadow: 0 0 0 1px #2f2f2f, 0 0 0 calc(var(--wp-admin-border-width-focus) + 1px) var(--wp-admin-theme-color);
|
|
524
515
|
}
|
|
525
516
|
|
|
517
|
+
.edit-site-code-editor {
|
|
518
|
+
position: relative;
|
|
519
|
+
width: 100%;
|
|
520
|
+
background-color: #fff;
|
|
521
|
+
flex-grow: 1;
|
|
522
|
+
}
|
|
523
|
+
.edit-site-code-editor__body {
|
|
524
|
+
width: 100%;
|
|
525
|
+
padding: 0 12px 12px 12px;
|
|
526
|
+
max-width: 1080px;
|
|
527
|
+
margin-left: auto;
|
|
528
|
+
margin-right: auto;
|
|
529
|
+
}
|
|
530
|
+
@media (min-width: 960px) {
|
|
531
|
+
.edit-site-code-editor__body {
|
|
532
|
+
padding: 16px 24px 96px 24px;
|
|
533
|
+
padding: 0 24px 24px 24px;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
.edit-site-code-editor__toolbar {
|
|
537
|
+
position: sticky;
|
|
538
|
+
z-index: 1;
|
|
539
|
+
top: 0;
|
|
540
|
+
left: 0;
|
|
541
|
+
right: 0;
|
|
542
|
+
display: flex;
|
|
543
|
+
background: rgba(255, 255, 255, 0.8);
|
|
544
|
+
padding: 4px 12px;
|
|
545
|
+
}
|
|
546
|
+
@media (min-width: 600px) {
|
|
547
|
+
.edit-site-code-editor__toolbar {
|
|
548
|
+
padding: 12px;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
@media (min-width: 960px) {
|
|
552
|
+
.edit-site-code-editor__toolbar {
|
|
553
|
+
padding: 12px 24px;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
.edit-site-code-editor__toolbar h2 {
|
|
557
|
+
line-height: 36px;
|
|
558
|
+
margin: 0 auto 0 0;
|
|
559
|
+
font-size: 13px;
|
|
560
|
+
color: #1e1e1e;
|
|
561
|
+
}
|
|
562
|
+
.edit-site-code-editor__toolbar .components-button svg {
|
|
563
|
+
order: 1;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area {
|
|
567
|
+
border: 1px solid #949494;
|
|
568
|
+
border-radius: 0;
|
|
569
|
+
display: block;
|
|
570
|
+
margin: 0;
|
|
571
|
+
width: 100%;
|
|
572
|
+
box-shadow: none;
|
|
573
|
+
resize: none;
|
|
574
|
+
overflow: hidden;
|
|
575
|
+
font-family: Menlo, Consolas, monaco, monospace;
|
|
576
|
+
line-height: 2.4;
|
|
577
|
+
min-height: 200px;
|
|
578
|
+
transition: border 0.1s ease-out, box-shadow 0.1s linear;
|
|
579
|
+
padding: 16px;
|
|
580
|
+
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
581
|
+
font-size: 16px !important;
|
|
582
|
+
}
|
|
583
|
+
@media (prefers-reduced-motion: reduce) {
|
|
584
|
+
textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area {
|
|
585
|
+
transition-duration: 0s;
|
|
586
|
+
transition-delay: 0s;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
@media (min-width: 600px) {
|
|
590
|
+
textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area {
|
|
591
|
+
padding: 24px;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
@media (min-width: 600px) {
|
|
595
|
+
textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area {
|
|
596
|
+
font-size: 15px !important;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:focus {
|
|
600
|
+
border-color: var(--wp-admin-theme-color);
|
|
601
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
602
|
+
position: relative;
|
|
603
|
+
}
|
|
604
|
+
textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-webkit-input-placeholder {
|
|
605
|
+
color: rgba(30, 30, 30, 0.62);
|
|
606
|
+
}
|
|
607
|
+
textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-moz-placeholder {
|
|
608
|
+
color: rgba(30, 30, 30, 0.62);
|
|
609
|
+
opacity: 1;
|
|
610
|
+
}
|
|
611
|
+
textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-input-placeholder {
|
|
612
|
+
color: rgba(30, 30, 30, 0.62);
|
|
613
|
+
}
|
|
614
|
+
|
|
526
615
|
.edit-site-global-styles-preview {
|
|
527
616
|
display: flex;
|
|
528
617
|
align-items: center;
|
|
529
618
|
justify-content: center;
|
|
530
|
-
min-height: 152px;
|
|
531
619
|
line-height: 1;
|
|
620
|
+
cursor: pointer;
|
|
532
621
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
width: 36px;
|
|
538
|
-
margin-left: 0;
|
|
539
|
-
padding: 0;
|
|
622
|
+
|
|
623
|
+
.edit-site-global-styles-preview__iframe {
|
|
624
|
+
max-width: 100%;
|
|
625
|
+
display: block;
|
|
540
626
|
}
|
|
541
627
|
|
|
542
628
|
.edit-site-typography-panel__preview {
|
|
@@ -567,13 +653,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
567
653
|
margin: 16px;
|
|
568
654
|
}
|
|
569
655
|
.edit-site-global-styles-screen-colors .component-color-indicator {
|
|
570
|
-
margin-left: 0;
|
|
571
|
-
display: block;
|
|
572
|
-
border-radius: 50%;
|
|
573
|
-
height: 24px;
|
|
574
|
-
width: 24px;
|
|
575
|
-
padding: 0;
|
|
576
|
-
border: 1px solid #ddd;
|
|
577
656
|
background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
578
657
|
}
|
|
579
658
|
|
|
@@ -597,20 +676,28 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
597
676
|
min-height: 32px;
|
|
598
677
|
}
|
|
599
678
|
|
|
600
|
-
h2.edit-site-global-styles-gradient-palette-panel__duotone-heading.components-heading {
|
|
601
|
-
text-transform: uppercase;
|
|
602
|
-
line-height: 24px;
|
|
603
|
-
font-weight: 500;
|
|
604
|
-
font-size: 11px;
|
|
605
|
-
margin-bottom: 8px;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
679
|
.edit-site-screen-text-color__control,
|
|
609
680
|
.edit-site-screen-link-color__control,
|
|
610
681
|
.edit-site-screen-background-color__control {
|
|
611
682
|
padding: 16px;
|
|
612
683
|
}
|
|
613
684
|
|
|
685
|
+
.edit-site-global-styles-variations_item {
|
|
686
|
+
box-sizing: border-box;
|
|
687
|
+
padding: 2px;
|
|
688
|
+
border-radius: 2px;
|
|
689
|
+
border: #e0e0e0 1px solid;
|
|
690
|
+
}
|
|
691
|
+
.edit-site-global-styles-variations_item.is-active {
|
|
692
|
+
border: #1e1e1e 1px solid;
|
|
693
|
+
}
|
|
694
|
+
.edit-site-global-styles-variations_item:hover {
|
|
695
|
+
border: var(--wp-admin-theme-color) 1px solid;
|
|
696
|
+
}
|
|
697
|
+
.edit-site-global-styles-variations_item:focus {
|
|
698
|
+
border: var(--wp-admin-theme-color) 1px solid;
|
|
699
|
+
}
|
|
700
|
+
|
|
614
701
|
.edit-site-header {
|
|
615
702
|
align-items: center;
|
|
616
703
|
background-color: #fff;
|
|
@@ -639,6 +726,8 @@ body.is-fullscreen-mode .edit-site-header {
|
|
|
639
726
|
display: flex;
|
|
640
727
|
align-items: center;
|
|
641
728
|
height: 100%;
|
|
729
|
+
flex-grow: 1;
|
|
730
|
+
justify-content: center;
|
|
642
731
|
min-width: 0;
|
|
643
732
|
}
|
|
644
733
|
.edit-site-header .edit-site-header_end {
|
|
@@ -716,7 +805,6 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
716
805
|
.edit-site-header__actions {
|
|
717
806
|
display: inline-flex;
|
|
718
807
|
align-items: center;
|
|
719
|
-
flex-wrap: wrap;
|
|
720
808
|
padding-right: 4px;
|
|
721
809
|
}
|
|
722
810
|
.edit-site-header__actions .interface-pinned-items {
|
|
@@ -771,6 +859,7 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
771
859
|
display: flex;
|
|
772
860
|
flex-direction: column;
|
|
773
861
|
justify-content: center;
|
|
862
|
+
padding: 0 8px;
|
|
774
863
|
height: 100%;
|
|
775
864
|
min-width: 0;
|
|
776
865
|
}
|
|
@@ -797,17 +886,6 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
797
886
|
white-space: nowrap;
|
|
798
887
|
overflow: hidden;
|
|
799
888
|
text-overflow: ellipsis;
|
|
800
|
-
max-width: 120px;
|
|
801
|
-
}
|
|
802
|
-
@media (min-width: 782px) {
|
|
803
|
-
.edit-site-document-actions .edit-site-document-actions__title {
|
|
804
|
-
max-width: 75px;
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
@media (min-width: 1080px) {
|
|
808
|
-
.edit-site-document-actions .edit-site-document-actions__title {
|
|
809
|
-
max-width: 180px;
|
|
810
|
-
}
|
|
811
889
|
}
|
|
812
890
|
.edit-site-document-actions .edit-site-document-actions__secondary-item {
|
|
813
891
|
white-space: nowrap;
|
|
@@ -1302,6 +1380,20 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1302
1380
|
margin: 0;
|
|
1303
1381
|
}
|
|
1304
1382
|
|
|
1383
|
+
.edit-site-global-styles-sidebar {
|
|
1384
|
+
display: flex;
|
|
1385
|
+
flex-direction: column;
|
|
1386
|
+
height: 100%;
|
|
1387
|
+
}
|
|
1388
|
+
.edit-site-global-styles-sidebar__panel, .edit-site-global-styles-sidebar__navigator-provider {
|
|
1389
|
+
display: flex;
|
|
1390
|
+
flex-direction: column;
|
|
1391
|
+
flex: 1;
|
|
1392
|
+
}
|
|
1393
|
+
.edit-site-global-styles-sidebar__navigator-screen {
|
|
1394
|
+
flex: 1;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1305
1397
|
.edit-site-global-styles-sidebar .interface-complementary-area-header .components-button.has-icon {
|
|
1306
1398
|
margin-left: 0;
|
|
1307
1399
|
}
|
|
@@ -1310,18 +1402,6 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1310
1402
|
margin-left: auto;
|
|
1311
1403
|
}
|
|
1312
1404
|
|
|
1313
|
-
.edit-site-global-styles-sidebar__border-controls-row {
|
|
1314
|
-
display: flex;
|
|
1315
|
-
justify-content: space-between;
|
|
1316
|
-
margin-bottom: 12px;
|
|
1317
|
-
}
|
|
1318
|
-
.edit-site-global-styles-sidebar__border-controls-row > * {
|
|
1319
|
-
width: calc(50% - 8px);
|
|
1320
|
-
}
|
|
1321
|
-
.edit-site-global-styles-sidebar__border-controls-row .components-border-style-control__buttons {
|
|
1322
|
-
margin-bottom: 0;
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
1405
|
.edit-site-global-styles-sidebar .components-navigation__menu-title-heading {
|
|
1326
1406
|
font-size: 15.6px;
|
|
1327
1407
|
font-weight: 500;
|
|
@@ -1336,6 +1416,10 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1336
1416
|
border: 0;
|
|
1337
1417
|
}
|
|
1338
1418
|
|
|
1419
|
+
.edit-site-global-styles-sidebar .components-tools-panel-item.single-column {
|
|
1420
|
+
grid-column: span 1;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1339
1423
|
.edit-site-global-styles-sidebar__blocks-group {
|
|
1340
1424
|
padding-top: 24px;
|
|
1341
1425
|
border-top: 1px solid #e0e0e0;
|
|
@@ -1707,11 +1791,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
1707
1791
|
display: flex;
|
|
1708
1792
|
justify-content: flex-end;
|
|
1709
1793
|
}
|
|
1710
|
-
@media (min-width: 782px) {
|
|
1711
|
-
.edit-site-editor__inserter-panel-header {
|
|
1712
|
-
display: none;
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
1794
|
|
|
1716
1795
|
.edit-site-editor__inserter-panel-content,
|
|
1717
1796
|
.edit-site-editor__list-view-panel-content {
|
|
@@ -1773,6 +1852,57 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
1773
1852
|
vertical-align: text-top;
|
|
1774
1853
|
}
|
|
1775
1854
|
|
|
1855
|
+
.edit-site-keyboard-shortcut-help-modal__section {
|
|
1856
|
+
margin: 0 0 2rem 0;
|
|
1857
|
+
}
|
|
1858
|
+
.edit-site-keyboard-shortcut-help-modal__main-shortcuts .edit-site-keyboard-shortcut-help-modal__shortcut-list {
|
|
1859
|
+
margin-top: -25px;
|
|
1860
|
+
}
|
|
1861
|
+
.edit-site-keyboard-shortcut-help-modal__section-title {
|
|
1862
|
+
font-size: 0.9rem;
|
|
1863
|
+
font-weight: 600;
|
|
1864
|
+
}
|
|
1865
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut {
|
|
1866
|
+
display: flex;
|
|
1867
|
+
align-items: baseline;
|
|
1868
|
+
padding: 0.6rem 0;
|
|
1869
|
+
border-top: 1px solid #ddd;
|
|
1870
|
+
margin-bottom: 0;
|
|
1871
|
+
}
|
|
1872
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut:last-child {
|
|
1873
|
+
border-bottom: 1px solid #ddd;
|
|
1874
|
+
}
|
|
1875
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut:empty {
|
|
1876
|
+
display: none;
|
|
1877
|
+
}
|
|
1878
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut-term {
|
|
1879
|
+
font-weight: 600;
|
|
1880
|
+
margin: 0 0 0 1rem;
|
|
1881
|
+
text-align: right;
|
|
1882
|
+
}
|
|
1883
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut-description {
|
|
1884
|
+
flex: 1;
|
|
1885
|
+
margin: 0;
|
|
1886
|
+
flex-basis: auto;
|
|
1887
|
+
}
|
|
1888
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination {
|
|
1889
|
+
display: block;
|
|
1890
|
+
background: none;
|
|
1891
|
+
margin: 0;
|
|
1892
|
+
padding: 0;
|
|
1893
|
+
}
|
|
1894
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination {
|
|
1895
|
+
margin-top: 10px;
|
|
1896
|
+
}
|
|
1897
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut-key {
|
|
1898
|
+
padding: 0.25rem 0.5rem;
|
|
1899
|
+
border-radius: 8%;
|
|
1900
|
+
margin: 0 0.2rem 0 0.2rem;
|
|
1901
|
+
}
|
|
1902
|
+
.edit-site-keyboard-shortcut-help-modal__shortcut-key:last-child {
|
|
1903
|
+
margin: 0 0 0 0.2rem;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1776
1906
|
html.wp-toolbar {
|
|
1777
1907
|
background: #fff;
|
|
1778
1908
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,42 +27,40 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^
|
|
32
|
-
"@wordpress/block-editor": "^8.
|
|
33
|
-
"@wordpress/block-library": "^
|
|
34
|
-
"@wordpress/blocks": "^11.1
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^4.
|
|
38
|
-
"@wordpress/data": "^6.1
|
|
39
|
-
"@wordpress/data-controls": "^2.
|
|
40
|
-
"@wordpress/editor": "^12.0
|
|
41
|
-
"@wordpress/element": "^4.
|
|
42
|
-
"@wordpress/hooks": "^3.
|
|
43
|
-
"@wordpress/html-entities": "^3.
|
|
44
|
-
"@wordpress/i18n": "^4.
|
|
45
|
-
"@wordpress/icons": "^6.
|
|
46
|
-
"@wordpress/interface": "^4.1
|
|
47
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
48
|
-
"@wordpress/keycodes": "^3.
|
|
49
|
-
"@wordpress/media-utils": "^3.
|
|
50
|
-
"@wordpress/notices": "^3.
|
|
51
|
-
"@wordpress/plugins": "^4.
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
54
|
-
"@wordpress/
|
|
55
|
-
"@wordpress/viewport": "^4.0.7",
|
|
30
|
+
"@wordpress/a11y": "^3.3.1",
|
|
31
|
+
"@wordpress/api-fetch": "^6.0.1",
|
|
32
|
+
"@wordpress/block-editor": "^8.1.1",
|
|
33
|
+
"@wordpress/block-library": "^7.0.0",
|
|
34
|
+
"@wordpress/blocks": "^11.2.1",
|
|
35
|
+
"@wordpress/components": "^19.4.0",
|
|
36
|
+
"@wordpress/compose": "^5.1.1",
|
|
37
|
+
"@wordpress/core-data": "^4.1.1",
|
|
38
|
+
"@wordpress/data": "^6.2.1",
|
|
39
|
+
"@wordpress/data-controls": "^2.3.1",
|
|
40
|
+
"@wordpress/editor": "^12.2.0",
|
|
41
|
+
"@wordpress/element": "^4.1.1",
|
|
42
|
+
"@wordpress/hooks": "^3.3.1",
|
|
43
|
+
"@wordpress/html-entities": "^3.3.1",
|
|
44
|
+
"@wordpress/i18n": "^4.3.1",
|
|
45
|
+
"@wordpress/icons": "^6.3.0",
|
|
46
|
+
"@wordpress/interface": "^4.2.1",
|
|
47
|
+
"@wordpress/keyboard-shortcuts": "^3.1.1",
|
|
48
|
+
"@wordpress/keycodes": "^3.3.1",
|
|
49
|
+
"@wordpress/media-utils": "^3.1.1",
|
|
50
|
+
"@wordpress/notices": "^3.3.1",
|
|
51
|
+
"@wordpress/plugins": "^4.1.1",
|
|
52
|
+
"@wordpress/reusable-blocks": "^3.1.1",
|
|
53
|
+
"@wordpress/url": "^3.4.1",
|
|
54
|
+
"@wordpress/viewport": "^4.1.1",
|
|
56
55
|
"classnames": "^2.3.1",
|
|
57
56
|
"downloadjs": "^1.4.7",
|
|
58
|
-
"file-saver": "^2.0.2",
|
|
59
57
|
"history": "^5.1.0",
|
|
60
|
-
"jszip": "^3.2.2",
|
|
61
58
|
"lodash": "^4.17.21",
|
|
59
|
+
"react-autosize-textarea": "^7.1.0",
|
|
62
60
|
"rememo": "^3.0.0"
|
|
63
61
|
},
|
|
64
62
|
"publishConfig": {
|
|
65
63
|
"access": "public"
|
|
66
64
|
},
|
|
67
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "2e4922861e49f5a090f9dc52056165092cfba163"
|
|
68
66
|
}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
align-items: center;
|
|
20
20
|
|
|
21
21
|
&.is-focus-mode {
|
|
22
|
-
padding:
|
|
22
|
+
padding: $grid-unit-60;
|
|
23
23
|
|
|
24
24
|
.edit-site-visual-editor__editor-canvas {
|
|
25
|
-
border-radius:
|
|
25
|
+
border-radius: $radius-block-ui;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// To hide the horizontal scrollbar and show the drag handle on the
|
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
overflow: visible;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
}
|
|
35
34
|
|
|
36
|
-
.
|
|
37
|
-
|
|
35
|
+
.components-resizable-box__container {
|
|
36
|
+
margin: 0 auto;
|
|
37
|
+
// Removing this will cancel the bottom margins in the iframe.
|
|
38
|
+
overflow: auto;
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
.edit-site-visual-editor__back-button {
|
|
@@ -50,12 +52,6 @@
|
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
.components-resizable-box__container {
|
|
54
|
-
margin: 0 auto;
|
|
55
|
-
// Removing this will cancel the bottom margins in the iframe.
|
|
56
|
-
overflow: auto;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
55
|
.resizable-editor__drag-handle {
|
|
60
56
|
$height: 100px;
|
|
61
57
|
position: absolute;
|
|
@@ -63,30 +59,26 @@
|
|
|
63
59
|
bottom: 0;
|
|
64
60
|
padding: 0;
|
|
65
61
|
margin: auto 0;
|
|
66
|
-
width: $grid-unit-
|
|
62
|
+
width: $grid-unit-05;
|
|
67
63
|
height: $height;
|
|
68
64
|
appearance: none;
|
|
69
|
-
cursor:
|
|
65
|
+
cursor: ew-resize;
|
|
70
66
|
outline: none;
|
|
71
|
-
background: $gray-
|
|
72
|
-
border-radius:
|
|
67
|
+
background: $gray-600;
|
|
68
|
+
border-radius: 2px;
|
|
73
69
|
border: 0;
|
|
74
70
|
|
|
75
71
|
&.is-left {
|
|
76
|
-
left:
|
|
72
|
+
left: -$grid-unit-20;
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
&.is-right {
|
|
80
|
-
right:
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&:hover {
|
|
84
|
-
background: $gray-600;
|
|
76
|
+
right: -$grid-unit-20;
|
|
85
77
|
}
|
|
86
78
|
|
|
79
|
+
&:hover,
|
|
87
80
|
&:active {
|
|
88
|
-
|
|
89
|
-
background: $gray-600;
|
|
81
|
+
background: $gray-400;
|
|
90
82
|
}
|
|
91
83
|
|
|
92
84
|
&:focus {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import Textarea from 'react-autosize-textarea';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* WordPress dependencies
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { __ } from '@wordpress/i18n';
|
|
16
|
+
import { useState } from '@wordpress/element';
|
|
17
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
18
|
+
import { VisuallyHidden } from '@wordpress/components';
|
|
19
|
+
|
|
20
|
+
export default function CodeEditorTextArea( { value, onChange, onInput } ) {
|
|
21
|
+
const [ stateValue, setStateValue ] = useState( value );
|
|
22
|
+
const [ isDirty, setIsDirty ] = useState( false );
|
|
23
|
+
const instanceId = useInstanceId( CodeEditorTextArea );
|
|
24
|
+
|
|
25
|
+
if ( ! isDirty && stateValue !== value ) {
|
|
26
|
+
setStateValue( value );
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Handles a textarea change event to notify the onChange prop callback and
|
|
31
|
+
* reflect the new value in the component's own state. This marks the start
|
|
32
|
+
* of the user's edits, if not already changed, preventing future props
|
|
33
|
+
* changes to value from replacing the rendered value. This is expected to
|
|
34
|
+
* be followed by a reset to dirty state via `stopEditing`.
|
|
35
|
+
*
|
|
36
|
+
* @see stopEditing
|
|
37
|
+
*
|
|
38
|
+
* @param {Event} event Change event.
|
|
39
|
+
*/
|
|
40
|
+
const onChangeHandler = ( event ) => {
|
|
41
|
+
const newValue = event.target.value;
|
|
42
|
+
onInput( newValue );
|
|
43
|
+
setStateValue( newValue );
|
|
44
|
+
setIsDirty( true );
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Function called when the user has completed their edits, responsible for
|
|
49
|
+
* ensuring that changes, if made, are surfaced to the onPersist prop
|
|
50
|
+
* callback and resetting dirty state.
|
|
51
|
+
*/
|
|
52
|
+
const stopEditing = () => {
|
|
53
|
+
if ( isDirty ) {
|
|
54
|
+
onChange( stateValue );
|
|
55
|
+
setIsDirty( false );
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<VisuallyHidden
|
|
62
|
+
as="label"
|
|
63
|
+
htmlFor={ `code-editor-text-area-${ instanceId }` }
|
|
64
|
+
>
|
|
65
|
+
{ __( 'Type text or HTML' ) }
|
|
66
|
+
</VisuallyHidden>
|
|
67
|
+
<Textarea
|
|
68
|
+
autoComplete="off"
|
|
69
|
+
dir="auto"
|
|
70
|
+
value={ stateValue }
|
|
71
|
+
onChange={ onChangeHandler }
|
|
72
|
+
onBlur={ stopEditing }
|
|
73
|
+
className="edit-site-code-editor-text-area"
|
|
74
|
+
id={ `code-editor-text-area-${ instanceId }` }
|
|
75
|
+
placeholder={ __( 'Start writing with text or HTML' ) }
|
|
76
|
+
/>
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { parse } from '@wordpress/blocks';
|
|
5
|
+
import { useEntityBlockEditor, useEntityProp } from '@wordpress/core-data';
|
|
6
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { Button } from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
15
|
+
import CodeEditorTextArea from './code-editor-text-area';
|
|
16
|
+
|
|
17
|
+
export default function CodeEditor() {
|
|
18
|
+
const { templateType, shortcut } = useSelect( ( select ) => {
|
|
19
|
+
const { getEditedPostType } = select( editSiteStore );
|
|
20
|
+
const { getShortcutRepresentation } = select( keyboardShortcutsStore );
|
|
21
|
+
return {
|
|
22
|
+
templateType: getEditedPostType(),
|
|
23
|
+
shortcut: getShortcutRepresentation( 'core/edit-site/toggle-mode' ),
|
|
24
|
+
};
|
|
25
|
+
}, [] );
|
|
26
|
+
const [ contentStructure, setContent ] = useEntityProp(
|
|
27
|
+
'postType',
|
|
28
|
+
templateType,
|
|
29
|
+
'content'
|
|
30
|
+
);
|
|
31
|
+
const [ blocks, , onChange ] = useEntityBlockEditor(
|
|
32
|
+
'postType',
|
|
33
|
+
templateType
|
|
34
|
+
);
|
|
35
|
+
const content =
|
|
36
|
+
contentStructure instanceof Function
|
|
37
|
+
? contentStructure( { blocks } )
|
|
38
|
+
: contentStructure;
|
|
39
|
+
const { switchEditorMode } = useDispatch( editSiteStore );
|
|
40
|
+
return (
|
|
41
|
+
<div className="edit-site-code-editor">
|
|
42
|
+
<div className="edit-site-code-editor__toolbar">
|
|
43
|
+
<h2>{ __( 'Editing code' ) }</h2>
|
|
44
|
+
<Button
|
|
45
|
+
variant="tertiary"
|
|
46
|
+
onClick={ () => switchEditorMode( 'visual' ) }
|
|
47
|
+
shortcut={ shortcut }
|
|
48
|
+
>
|
|
49
|
+
{ __( 'Exit code editor' ) }
|
|
50
|
+
</Button>
|
|
51
|
+
</div>
|
|
52
|
+
<div className="edit-site-code-editor__body">
|
|
53
|
+
<CodeEditorTextArea
|
|
54
|
+
value={ content }
|
|
55
|
+
onChange={ ( newContent ) => {
|
|
56
|
+
onChange( parse( newContent ), {
|
|
57
|
+
selection: undefined,
|
|
58
|
+
} );
|
|
59
|
+
} }
|
|
60
|
+
onInput={ setContent }
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|