Skip to content

Commit 8f70b51

Browse files
committed
fix: unescape Gutenberg title value
issue #1495
1 parent 1b61754 commit 8f70b51

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

client/src/lib/wordpress.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import { get } from 'lodash'
22

33
export const store = get(window, ['wp', 'data'], null)
44
export const media = get(window, ['wp', 'media'], null)
5+
export const htmlEntities = get(window, ['wp', 'htmlEntities'], null)
56
export const postTitleInput: HTMLInputElement | null = document.querySelector('input[name="post_title"]')
67
export const postTitleListener = (cb: (title: string) => any) => postTitleInput?.addEventListener('change', event => cb(get(event, ['target', 'value'])))

client/src/sagas/wordpress.sagas.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ function* wordpressGutenbergUpdate() {
3636
yield put(
3737
wordpressStore.update({
3838
prop: 'title',
39-
value: wordpress.store.select('core/editor').getEditedPostAttribute('title'),
39+
value: wordpress.htmlEntities.decodeEntities(
40+
wordpress.store.select('core/editor').getEditedPostAttribute('title')
41+
),
4042
})
4143
)
4244
}

0 commit comments

Comments
 (0)