GenerateBgImage.js
5 years ago
asyncHooks.js
5 years ago
capitalize.js
5 years ago
color-code-to-class.js
5 years ago
color-slug-to-color-code.js
4 years ago
common.scss
4 years ago
convert-to-grid.js
5 years ago
default-color-palette.js
5 years ago
delete-from-array.js
5 years ago
depModules.js
4 years ago
example-data.js
5 years ago
fixBrokenUnicode.js
5 years ago
font-awesome-new.js
5 years ago
font-awesome.js
5 years ago
formatNumCol.js
5 years ago
hex-to-rgba.js
5 years ago
hiddenNewBlock.js
5 years ago
hooks.js
5 years ago
is-hex-color.js
4 years ago
is-not-json.js
5 years ago
multi-array-flaten.js
5 years ago
removeProperty.js
5 years ago
replaceClientId.js
5 years ago
taxonomy-utils.js
5 years ago
to-number.js
5 years ago
depModules.js
53 lines
| 1 | import { select, dispatch } from '@wordpress/data'; |
| 2 | /** |
| 3 | * 下記は vkbBlockEditor でしか使われていなかったのでコメントアウト |
| 4 | * vkbBlockEditor が復活したり他で� |
| 5 | 要になったときのために一応残す |
| 6 | */ |
| 7 | // import * as blockEditor from '@wordpress/block-editor'; |
| 8 | // import * as editor from '@wordpress/editor'; |
| 9 | import ServerSideRender from '@wordpress/server-side-render'; |
| 10 | import * as components from '@wordpress/components'; |
| 11 | |
| 12 | /* |
| 13 | ・vkbBlockEditor はすでに使われていない |
| 14 | ・@wordpress/editor を読み込むと 外観 > ウィジェット で怒られる |
| 15 | ("wp-editor" script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets).) |
| 16 | |
| 17 | 上記の点からコメントアウトしました |
| 18 | |
| 19 | export const vkbBlockEditor = |
| 20 | blockEditor && blockEditor.BlockEdit ? blockEditor : editor; |
| 21 | */ |
| 22 | export const depServerSideRender = () => { |
| 23 | if (ServerSideRender) { |
| 24 | return ServerSideRender; |
| 25 | } |
| 26 | return components.ServerSideRender; |
| 27 | }; |
| 28 | |
| 29 | export const selectEditor = select('core/block-editor') |
| 30 | ? select('core/block-editor') |
| 31 | : select('core/editor'); |
| 32 | export const dispatchEditor = dispatch('core/block-editor') |
| 33 | ? dispatch('core/block-editor') |
| 34 | : dispatch('core/editor'); |
| 35 | |
| 36 | //fixBrokenUnicode.jsに同じ関数がある。リファクタリング後に移行。 |
| 37 | export const isValidJson = (value) => { |
| 38 | try { |
| 39 | JSON.parse(value); |
| 40 | } catch (e) { |
| 41 | return false; |
| 42 | } |
| 43 | return true; |
| 44 | }; |
| 45 | //fixBrokenUnicode.jsに同じ関数がある。リファクタリング後に移行。 |
| 46 | export const fixBrokenUnicode = (text) => { |
| 47 | if (!isValidJson(text)) { |
| 48 | text = text.replace(/u0022/g, '"'); |
| 49 | } |
| 50 | |
| 51 | return text; |
| 52 | }; |
| 53 |