This is a plugin for the Movable Type. This plugin provides unitities to export MTBlockEditor data as a data structure.
- Download an archive file from releases.
- Unpack the archive file.
- Upload the unpacked files to your MT directory.
Should look like this when installed:
$MT_HOME/
plugins/
MTBlockEditorCustomFormat/
<mt:ContentField content_field="a_block_editor_field">
<mt:ContentFieldValue convert_breaks="0" mtbe_custom_json="simple_with_meta","pretty" />
</mt:ContentField>
Output
[
{
"content" : "\u003cp\u003etest\u003c\u002fp\u003e",
"type" : "core-text"
},
{
"content" : "\u003cblockquote class=\"twitter-tweet\" data-width=\"550\"\u003e\u003cp lang=\"ja\" dir=\"ltr\"\u003e【オンラインミニセミナー本日開催👩💻】\u003cbr\u003eセキュリティやコンプライアンス管理の徹底を求められる企業サイト。でも高価なハイエンドCMSはコストが合わない…そんなケースにおすすめの「Movable Type SmartSync Pack」を徹底解説。短時間ですのでお気軽にご参加ください💁♀️\u003ca href=\"https:\u002f\u002ft.co\u002fYuBldvJmOY\"\u003ehttps:\u002f\u002ft.co\u002fYuBldvJmOY\u003c\u002fa\u003e\u003c\u002fp\u003e— シックス・アパート株式会社 (@sixapartkk) \u003ca href=\"https:\u002f\u002ftwitter.com\u002fsixapartkk\u002fstatus\u002f1349521164503171076?ref_src=twsrc%5Etfw\"\u003eJanuary 14, 2021\u003c\u002fa\u003e\u003c\u002fblockquote\u003e\u003cscript async src=\"https:\u002f\u002fplatform.twitter.com\u002fwidgets.js\" charset=\"utf-8\"\u003e\u003c\u002fscript\u003e",
"type" : "sixapart-oembed",
"meta" : {
"providerName" : "Twitter",
"maxwidth" : "640",
"url" : "https:\u002f\u002ftwitter.com\u002fsixapartkk\u002fstatus\u002f1349521164503171076",
"width" : 550
}
}
]
https://example.com/cgi-bin/mt/mt-data-api.cgi/v4/sites/1/contentTypes/1/data/1?fields=data_mtbe_custom&mtbe_custom=simple_with_meta
Output
{
"data_mtbe_custom": [
{
"data": [
{
"content": "<p>test</p>",
"type": "core-text"
},
{
"content": "<blockquote class=\"twitter-tweet\" data-width=\"550\"><p lang=\"ja\" dir=\"ltr\">【オンラインミニセミナー本日開催👩💻】<br>セキュリティやコンプライアンス管理の徹底を求められる企業サイト。でも高価なハイエンドCMSはコストが合わない…そんなケースにおすすめの「Movable Type SmartSync Pack」を徹底解説。短時間ですのでお気軽にご参加ください💁♀️<a href=\"https://t.co/YuBldvJmOY\">https://t.co/YuBldvJmOY</a></p>— シックス・アパート株式会社 (@sixapartkk) <a href=\"https://twitter.com/sixapartkk/status/1349521164503171076?ref_src=twsrc%5Etfw\">January 14, 2021</a></blockquote><script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>",
"meta": {
"maxwidth": "640",
"providerName": "Twitter",
"url": "https://twitter.com/sixapartkk/status/1349521164503171076",
"width": 550
},
"type": "sixapart-oembed"
}
],
"id": "7",
"label": "a-mt-block-editor-field",
"type": "multi_line_text"
},
]
}
https://example.com/cgi-bin/mt/mt-data-api.cgi/v4/sites/1/entries/1?fields=body_mtbe_custom,more_mtbe_custom&mtbe_custom=simple_with_meta
Output
{
"body_mtbe_custom": [
{
"content": "<p>test block</p>",
"type": "core-text"
},
{
"content": "<blockquote class=\"twitter-tweet\"><p lang=\"ja\" dir=\"ltr\">【オンラインミニセミナー本日開催👩💻】<br>セキュリティやコンプライアンス管理の徹底を求められる企業サイト。でも高価なハイエンドCMSはコストが合わない...そんなケースにおすすめの「Movable Type SmartSync Pack」を徹底解説。短時間ですのでお気軽にご参加ください💁♀️<a href=\"https://t.co/YuBldvJmOY\">https://t.co/YuBldvJmOY</a></p>— シックス・アパート株式会社 (@sixapartkk) <a href=\"https://twitter.com/sixapartkk/status/1349521164503171076?ref_src=twsrc%5Etfw\">January 14, 2021</a></blockquote><script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>",
"meta": {
"providerName": "Twitter",
"url": "https://twitter.com/sixapartkk/status/1349521164503171076",
"width": 550
},
"type": "sixapart-oembed"
}
],
"more_mtbe_custom": [
{
"content": "<p><img src=\"https://example.com/2021-04-06-IMG_5565.jpg\" alt=\"\" width=\"3888\" height=\"2592\" class=\"asset asset-image mt-image-center\" style=\"max-width:100%;height:auto;display:block;margin-left:auto;margin-right:auto\"/></p>",
"meta": {
"alignment": "center",
"assetId": "91",
"useThumbnail": false
},
"type": "mt-image"
}
]
}
You can specify the following values for the "mtbe_custom_json" parameter in MTML and "mtbe_custom" in Data API.
- strip_meta_all
- Remove all metadata.
- strip_meta_setup
- Remove metadata (label and help text) for setup.
- dedup_content
- Removes the content contained in the child's blocks from the parent block in order to removes duplicates.
- stringify_content
- The content data saved as an array (internal data structrue) is converted to a character string.
- raw
- Outputs the internal data structure as it is
- pretty
- Specify the "pretty" flag for the JSON encoder.
- ascii
- Specify the "ascii" flag for the JSON encoder.
Presets that combines multiple specifications.
- simple
-
- strip_meta_all
- dedup_content
- stringify_content
- simple_with_meta
-
- strip_meta_setup
- dedup_content
- stringify_content
- Movable Type 7
- MTBlockEditor plugin (1.0.6 or later)
This library is free software released under the MIT. Please see LICENSE.txt
The following copyright notice applies to all the files provided in this distribution, including binary files, unless explicitly noted otherwise.
Copyright 2021 Six Apart Ltd.