Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7f1d3fc
Avoid flickering by setting boundary class when creating the DOM tree
ellatrix Jan 23, 2019
fa8722e
Remove TinyMCE boundaries
ellatrix Jan 23, 2019
e269593
Remove TinyMCE so it doesn't interfere with our boundaries
ellatrix Jan 30, 2019
8435016
Fix failing unit tests
ellatrix Jan 30, 2019
5ba90fd
Only have one boundary class at a time
ellatrix Jan 30, 2019
ed4200d
Remove filterString param
ellatrix Jan 30, 2019
86de3a9
Build in own padding and boundary classes
ellatrix Jan 30, 2019
ccf61e7
Update styling
ellatrix Jan 30, 2019
4365fe8
valueToFormat shouldn't create editable tree
ellatrix Jan 30, 2019
2e789e7
Add zero with spaces around formatting
ellatrix Jan 31, 2019
3d0e224
Remove old boundary compatibility code
ellatrix Jan 31, 2019
32ff15f
Update dom diff, prevent browser selection overwrite on boundary
ellatrix Feb 1, 2019
b6c7d25
Update UI
ellatrix Feb 1, 2019
2e3850e
Fix inserting format with shortcut
ellatrix Feb 4, 2019
5ad78e0
Add check
ellatrix Feb 4, 2019
1a88924
Remove nbsp inserted by TinyMCE from test
ellatrix Feb 4, 2019
421876c
Do not mutate attirbutes object
ellatrix Feb 4, 2019
d2b0c7e
Fix link e2e tests
ellatrix Feb 4, 2019
fa45d75
WIP
ellatrix Feb 5, 2019
781ce79
WIP: try boundaries without DOM
ellatrix Feb 6, 2019
90b38a8
Remove zero width space everywhere
ellatrix Feb 6, 2019
4cd0bf4
Fix e2e tests
ellatrix Feb 6, 2019
25d2ade
Clean up
ellatrix Feb 6, 2019
89164fd
Revert selection snapshots
ellatrix Feb 7, 2019
29008e5
Correctly remove dependencies
ellatrix Feb 7, 2019
47f0d05
Add nested boundary test
ellatrix Feb 7, 2019
294ca35
Add backtick test
ellatrix Feb 7, 2019
3573ebb
Fix annotation tests: they now have boundaries
ellatrix Feb 7, 2019
fd8b71c
Merge logic
ellatrix Feb 7, 2019
b4cf4f3
Fix getActiveFormat test
ellatrix Feb 7, 2019
8b434d7
Update some docs and dependencies
ellatrix Feb 7, 2019
db35c6b
Fix block CSS
ellatrix Feb 7, 2019
9a78bf4
Return focus to editable after pressing format button
ellatrix Feb 8, 2019
ab58913
Update docs
ellatrix Feb 8, 2019
b4a7be8
Update changelogs
ellatrix Feb 8, 2019
74b3a38
Add changelog headings
ellatrix Feb 8, 2019
b488d83
Remove obsolete onFocus class method from Editable
ellatrix Feb 8, 2019
11378ef
Restore :focus
ellatrix Feb 8, 2019
894c0d8
Update TinyMCE mentions
ellatrix Feb 8, 2019
26ef673
Use Escape instead of mouse move
ellatrix Feb 8, 2019
0518174
Update isHorizontalEdge comment
ellatrix Feb 8, 2019
1b5a628
Add docs for fromFormat
ellatrix Feb 8, 2019
7e5b221
Create test content manually
ellatrix Feb 8, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ In the code snippet above, when loading the editor, we will extract the `content

Earlier examples used the `createElement` function to create DOM nodes, but it's also possible to encapsulate this behavior into ["components"](). This abstraction helps as a pattern to share common behaviors and to hide complexity into self-contained units. There are a number of components available to use in implementing your blocks. You can see one such component in the snippet above: the [`RichText` component]().

The `RichText` component can be considered as a super-powered `textarea` element, enabling rich content editing including bold, italics, hyperlinks, etc. It is not too much unlike the single editor region of the legacy post editor, and is in fact powered by the same TinyMCE library.
The `RichText` component can be considered as a super-powered `textarea` element, enabling rich content editing including bold, italics, hyperlinks, etc.

To use the `RichText` component, add `wp-editor` to the array of registered script handles when calling `wp_register_script`.

```php
wp_register_script(
'gutenberg-boilerplate-es5-step03',
plugins_url( 'step-03/block.js', __FILE__ ),
array(
'wp-blocks',
'wp-element',
array(
'wp-blocks',
'wp-element',
'wp-editor', // Note the addition of wp-editor to the dependencies
)
);
Expand Down
4 changes: 2 additions & 2 deletions docs/designers-developers/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Here is a brief animation illustrating how to find and use the keyboard shortcut

## Is Gutenberg built on top of TinyMCE?

No. [TinyMCE](https://www.tinymce.com/) is one of the best tools for enabling rich text on the web. In Gutenberg, TinyMCE does exactly that. Nearly every text field you'll find is augmented with TinyMCE for rich text. Whether it be text, lists, or even just a single caption, TinyMCE can be invoked on blocks for rich text enhancements.
Comment thread
ellatrix marked this conversation as resolved.
Resolved
No. [TinyMCE](https://www.tinymce.com/) is only used for the "Classic" block.

## What browsers will Gutenberg support?

Expand Down Expand Up @@ -320,7 +320,7 @@ We realize it's a big change. We also think there will be many new opportunities

## Will I be able to opt out of Gutenberg for my site?

There is a “Classic” block, which is virtually the same as the current editor, except in block form.
There is a “Classic” block, which is virtually the same as the current editor, except in block form.

There is also the [Classic Editor Plugin](https://wordpress.org/plugins/classic-editor/) which restores the previous editor, see the plugin for more information. The WordPress Core team has committed to supporting the Classic Editor Plugin [until December 2021](https://make.wordpress.org/core/2018/11/07/classic-editor-plugin-support-window/).

Expand Down
2 changes: 1 addition & 1 deletion docs/designers-developers/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dd>A sidebar region containing metadata fields for the post, including scheduling, visibility, terms, and featured image.</dd>

<dt>RichText</dt>
<dd>A common component enabling rich content editing including bold, italics, hyperlinks, etc. It is not too much unlike the single editor region of the legacy post editor, and is in fact powered by the same TinyMCE library.</dd>
<dd>A common component enabling rich content editing including bold, italics, hyperlinks, etc.</dd>

<dt>Reusable block</dt>
<dd>A block that is saved and then can be shared as a reusable, repeatable piece of content.</dd>
Expand Down
2 changes: 0 additions & 2 deletions lib/packages-dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
),
'wp-dom' => array(
'lodash',
'wp-tinymce',
),
'wp-dom-ready' => array(),
'wp-edit-post' => array(
Expand Down Expand Up @@ -153,7 +152,6 @@
'wp-notices',
'wp-nux',
'wp-rich-text',
'wp-tinymce',
'wp-token-list',
'wp-url',
'wp-viewport',
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions packages/block-library/src/button/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
margin-bottom: 0;
position: relative;

.editor-rich-text__tinymce.mce-content-body {
[contenteditable] {
cursor: text;
}

// Make placeholder text white unless custom colors or outline versions are chosen.
&:not(.has-text-color):not(.is-style-outline) .editor-rich-text__tinymce[data-is-placeholder-visible="true"] + .editor-rich-text__tinymce {
&:not(.has-text-color):not(.is-style-outline) .editor-rich-text__editable[data-is-placeholder-visible="true"] + .editor-rich-text__editable {
color: $white;
}

// Increase placeholder opacity to meet contrast ratios.
.editor-rich-text__tinymce[data-is-placeholder-visible="true"] + .editor-rich-text__tinymce {
.editor-rich-text__editable[data-is-placeholder-visible="true"] + .editor-rich-text__editable {
opacity: 0.8;
}

Expand All @@ -33,7 +33,7 @@
max-width: 100%;

// Polish the empty placeholder text for the button in variation previews.
.editor-rich-text__tinymce[data-is-placeholder-visible="true"] {
.editor-rich-text__editable[data-is-placeholder-visible="true"] {
height: auto;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ exports[`core/button block edit matches snapshot 1`] = `
aria-autocomplete="list"
aria-label="Add text…"
aria-multiline="true"
class="wp-block-button__link editor-rich-text__tinymce"
class="wp-block-button__link editor-rich-text__editable"
contenteditable="true"
data-is-placeholder-visible="true"
role="textbox"
>
<br
data-mce-bogus="1"
data-rich-text-padding="true"
/>
</div>
<div
class="editor-rich-text__tinymce wp-block-button__link"
class="editor-rich-text__editable wp-block-button__link"
>
Add text…
</div>
Expand Down
9 changes: 1 addition & 8 deletions packages/block-library/src/cover/editor.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
.wp-block-cover-image,
.wp-block-cover {
.editor-rich-text__tinymce[data-is-empty="true"]::before {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data-is-empty was removed in #1485 (thanks @aduth), so I'm removing the styles as they're most likely very outdated and haven't worked in 1.5 years.

position: inherit;
}

.editor-rich-text__tinymce:focus a[data-mce-selected] {
padding: 0 2px;
margin: 0 -2px;
border-radius: 2px;
.editor-rich-text__editable:focus a[data-rich-text-format-boundary] {
box-shadow: none;
background: rgba(255, 255, 255, 0.3);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/gallery/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ul.wp-block-gallery li {
}

// Make extra space for the inline toolbar.
.editor-rich-text__tinymce {
figcaption {
padding-top: 48px;
}
}
Expand Down Expand Up @@ -78,12 +78,12 @@ ul.wp-block-gallery li {
}
}

.editor-rich-text .editor-rich-text__tinymce {
.editor-rich-text figcaption {
a {
color: $white;
}

&:focus a[data-mce-selected] {
&:focus a[data-rich-text-format-boundary] {
color: rgba(0, 0, 0, 0.2);
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/heading/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
}

// Adjust line spacing for larger headings.
h1.editor-rich-text__tinymce,
h2.editor-rich-text__tinymce,
h3.editor-rich-text__tinymce {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love these removals but I think this is also something we should document in the release... as some themes might have relied on these tinymce classNames. Granted that the components classNames should not be considered public API.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also drop a note to the themes/design team once this lands to check the twenty* themes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We should really discourage the use of these classes. The only reasonable uses I've seen is to style the placeholder or boundaries differently. Ideally the default styles should work for anything though. Worth looking into at some point.

h1,
h2,
h3 {
line-height: 1.4;
}

h4.editor-rich-text__tinymce {
h4 {
line-height: 1.5;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ exports[`core/heading block edit matches snapshot 1`] = `
aria-autocomplete="list"
aria-label="Write heading…"
aria-multiline="true"
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
contenteditable="true"
data-is-placeholder-visible="true"
role="textbox"
>
<br
data-mce-bogus="1"
data-rich-text-padding="true"
/>
</h2>
<h2
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
>
Write heading…
</h2>
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/list/editor.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.block-library-list .editor-rich-text__tinymce,
.block-library-list .editor-rich-text__tinymce ul,
.block-library-list .editor-rich-text__tinymce ol {
.editor-styles-wrapper .block-library-list ul,
.editor-styles-wrapper .block-library-list ol {
padding-left: 1.3em;
margin-left: 1.3em;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ exports[`core/list block edit matches snapshot 1`] = `
aria-autocomplete="list"
aria-label="Write list…"
aria-multiline="true"
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
contenteditable="true"
data-is-placeholder-visible="true"
role="textbox"
>
<li>
<br
data-mce-bogus="1"
data-rich-text-padding="true"
/>
</li>
</ul>
<ul
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
>
<li>
Write list…
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/paragraph/editor.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Specific to the empty paragraph placeholder:
// when shown on mobile and in nested contexts, one or more icons show up on the right.
// This padding makes sure it doesn't overlap text.
.editor-rich-text__tinymce[data-is-placeholder-visible="true"] + .editor-rich-text__tinymce.wp-block-paragraph {
.editor-rich-text__editable[data-is-placeholder-visible="true"] + .editor-rich-text__editable.wp-block-paragraph {
padding-right: $icon-button-size * 3;

// In nested contexts only one icon shows up.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ exports[`core/paragraph block edit matches snapshot 1`] = `
aria-autocomplete="list"
aria-label="Empty block; start writing or type forward slash to choose a block"
aria-multiline="true"
class="wp-block-paragraph editor-rich-text__tinymce"
class="wp-block-paragraph editor-rich-text__editable"
contenteditable="true"
data-is-placeholder-visible="true"
role="textbox"
>
<br
data-mce-bogus="1"
data-rich-text-padding="true"
/>
</p>
<p
class="editor-rich-text__tinymce wp-block-paragraph"
class="editor-rich-text__editable wp-block-paragraph"
>
Start writing or type / to choose a block
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ exports[`core/preformatted block edit matches snapshot 1`] = `
aria-autocomplete="list"
aria-label="Write preformatted text…"
aria-multiline="true"
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
contenteditable="true"
data-is-placeholder-visible="true"
role="textbox"
>
<br
data-mce-bogus="1"
data-rich-text-padding="true"
/>
</pre>
<pre
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
>
Write preformatted text…
</pre>
Expand Down
13 changes: 0 additions & 13 deletions packages/block-library/src/pullquote/editor.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
.editor-block-list__block[data-type="core/pullquote"] {
&[data-align="left"],
&[data-align="right"] {
& .block-library-pullquote__content .editor-rich-text__tinymce[data-is-empty="true"]::before,
& .editor-rich-text p {
font-size: 20px;
}
}
}

.wp-block-pullquote {
cite .editor-rich-text__tinymce[data-is-empty="true"]::before {
font-size: 14px;
font-family: $default-font;
}

.editor-rich-text__tinymce[data-is-empty="true"]::before {
width: 100%;
left: 50%;
transform: translateX(-50%);
}

& blockquote > .block-library-pullquote__content .editor-rich-text__tinymce[data-is-empty="true"]::before,
& blockquote > .editor-rich-text p {
font-size: 28px;
line-height: 1.6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ exports[`core/pullquote block edit matches snapshot 1`] = `
aria-autocomplete="list"
aria-label="Write quote…"
aria-multiline="true"
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
contenteditable="true"
data-is-placeholder-visible="true"
role="textbox"
>
<p>
<br
data-mce-bogus="1"
data-rich-text-padding="true"
/>
</p>
</div>
<div
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
>
<p>
Write quote…
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ exports[`core/quote block edit matches snapshot 1`] = `
aria-autocomplete="list"
aria-label="Write quote…"
aria-multiline="true"
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
contenteditable="true"
data-is-placeholder-visible="true"
role="textbox"
>
<p>
<br
data-mce-bogus="1"
data-rich-text-padding="true"
/>
</p>
</div>
<div
class="editor-rich-text__tinymce"
class="editor-rich-text__editable"
>
<p>
Write quote…
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/text-columns/editor.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.wp-block-text-columns {
.editor-rich-text__tinymce:focus {
.editor-rich-text__editable:focus {
outline: $border-width solid $light-gray-500;
}
}
Loading