{"id":35546621,"url":"https://github.com/pickles2/lib-px2-contents-editor","last_synced_at":"2026-01-20T17:05:40.844Z","repository":{"id":53265097,"uuid":"53965434","full_name":"pickles2/lib-px2-contents-editor","owner":"pickles2","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-29T12:27:35.000Z","size":21712,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-30T20:56:15.197Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pickles2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-03-15T17:38:36.000Z","updated_at":"2025-07-29T12:27:53.000Z","dependencies_parsed_at":"2023-07-25T17:56:46.665Z","dependency_job_id":"ef098b73-72a1-4aaa-a793-579b88919e92","html_url":"https://github.com/pickles2/lib-px2-contents-editor","commit_stats":null,"previous_names":["pickles2/lib-px2-contents-editor","pickles2/node-pickles2-contents-editor"],"tags_count":41,"template":false,"template_full_name":null,"purl":"pkg:github/pickles2/lib-px2-contents-editor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pickles2%2Flib-px2-contents-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pickles2%2Flib-px2-contents-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pickles2%2Flib-px2-contents-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pickles2%2Flib-px2-contents-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pickles2","download_url":"https://codeload.github.com/pickles2/lib-px2-contents-editor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pickles2%2Flib-px2-contents-editor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-04T06:02:13.334Z","updated_at":"2026-01-20T17:05:40.823Z","avatar_url":"https://github.com/pickles2.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pickles2/lib-px2-contents-editor\n\n[Pickles 2](https://pickles2.com/) のコンテンツ編集インターフェイスを提供します。\n\n## Usage\n\n### Server Side (PHP)\n\n```php\n\u003c?php\n/**\n * api.php\n */\nrequire_once('vendor/autoload.php');\n\n$px2ce = new pickles2\\libs\\contentsEditor\\main();\n$px2ce-\u003einit(array(\n\t'target_mode' =\u003e 'page_content', // \u003c- 編集対象のモード ('page_content' (default) or 'theme_layout')\n\t'page_path' =\u003e '/path/to/page.html', // \u003c- 編集対象ページのパス (target_mode=theme_layout のとき、 `/{theme_id}/{layout_id}.html` の形式)\n\t'theme_id' =\u003e 'your_target_theme', // \u003c- (target_mode=theme_layout のとき) 編集対象のテーマID\n\t'layout_id' =\u003e 'your_target_layout', // \u003c- (target_mode=theme_layout のとき) 編集対象のレイアウトID\n\t'appMode' =\u003e 'web', // 'web' or 'desktop'. default to 'web'\n\t'entryScript' =\u003e '/realpath/to/.px_execute.php', // Pickles 2 のエンドポイント\n\t'customFields' =\u003e array(\n\t\t// カスタムフィールドのサーバーサイドスクリプト。クラス名(ネームスペース含む)を指定します。\n\t\t// この関数は、`broccoliHtmlEditor\\fieldBase` を基底クラスとして継承します。\n\t\t// customFields オブジェクトのキー(ここでは custom1)が、フィールドの名称になります。\n\t\t'custom1' =\u003e 'test_php_field_custom1',\n\t) ,\n\t'log' =\u003e function($msg){\n\t\t// ログ情報出力時にコールされます。\n\t\t// $msg を受け取り、適切なファイルへ出力するように実装してください。\n\t\tfile_put_contents('/path/to/px2ce.log', $msg);\n\t},\n\t'commands' =\u003e array(\n\t\t'php' =\u003e array(\n\t\t\t// PHPコマンドのパスを表すオブジェクト\n\t\t\t// または、 文字列で '/path/to/php' とすることも可 (この場合、 php.ini のパスは指定されない)\n\t\t\t'bin' =\u003e '/path/to/php',\n\t\t\t'ini' =\u003e '/path/to/php.ini',\n\t\t),\n\t),\n\t'noimagePlaceholder' =\u003e '/path/to/noimage-placeholder.png',\n));\n\nif($_GET['client_resources'] ?? null){\n\t$value = $px2ce-\u003eget_client_resources(__DIR__.'/caches/');\n\theader('Content-type: text/json');\n\techo json_encode($value);\n\texit;\n}\n$value = $px2ce-\u003egpi( json_decode( $_REQUEST['data'] ) );\nheader('Content-type: text/json');\necho json_encode($value);\nexit;\n```\n\n\n### Client Side\n\n```php\n\u003cdiv id=\"canvas\"\u003e\u003c/div\u003e\n\n\u003c!--\nエディタが利用する CSS や JavaScript などのリソースファイルがあります。\n`$px2ce-\u003eget_client_resources()` からリソースの一覧を取得し、読み込んでください。\n--\u003e\n\n\u003c?php\nrequire_once('vendor/autoload.php');\n\n$px2ce = new pickles2\\libs\\contentsEditor\\main();\n$px2ce-\u003einit( /* any options */ );\n\n$resources = $px2ce-\u003eget_client_resources();\nforeach($resources-\u003ecss as $css_file){\n\techo('\u003clink rel=\"stylesheet\" href=\"'.htmlspecialchars($css_file).'\" /\u003e');\n}\nforeach($resources-\u003ejs as $js_file){\n\techo('\u003cscript src=\"'.htmlspecialchars($js_file).'\"\u003e\u003c/script\u003e');\n}\n?\u003e\n\n\u003cscript\u003e\nvar pickles2ContentsEditor = new Pickles2ContentsEditor();\npickles2ContentsEditor.init(\n\t{\n\t\t'page_path': '/path/to/page.html' , // \u003c- 編集対象ページのパス\n\t\t'elmCanvas': document.getElementById('canvas'), // \u003c- 編集画面を描画するための器となる要素\n\t\t'preview':{ // プレビュー用サーバーの情報を設定します。\n\t\t\t'origin': 'http://127.0.0.1:8081'\n\t\t},\n\t\t'lang': 'en', // language\n        'appearance': 'dark', // light, dark, auto(default)\n\t\t'customFields': {\n\t\t\t// この設定項目は、 broccoli-html-editor に渡されます\n\t\t\t'custom1': function(broccoli){\n\t\t\t\t// カスタムフィールドを実装します。\n\t\t\t\t// この関数は、fieldBase.js を基底クラスとして継承します。\n\t\t\t\t// customFields オブジェクトのキー(ここでは custom1)が、フィールドの名称になります。\n\t\t\t}\n\t\t},\n\t\t'gpiBridge': function(input, callback){\n\t\t\t// GPI(General Purpose Interface) Bridge\n\t\t\t// broccoliは、バックグラウンドで様々なデータ通信を行います。\n\t\t\t// GPIは、これらのデータ通信を行うための汎用的なAPIです。\n\t\t\t$.ajax({\n\t\t\t\t\"url\": '/your/api/path',\n\t\t\t\t\"type\": 'post',\n\t\t\t\t'data': {'data':JSON.stringify(input)},\n\t\t\t\t\"success\": function(data){\n\t\t\t\t\tcallback(data);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t},\n\t\t'clipboard': {\n\t\t\t// クリップボード操作の機能を拡張できます。\n\t\t\t'set': function( data, type ){\n\t\t\t\t// クリップボードにコピーする機能を実装してください。\n\t\t\t},\n\t\t\t'get': function( type ){\n\t\t\t\t// クリップボードからデータを取得する機能を実装してください。\n\t\t\t},\n\t\t},\n\t\t'complete': function(){\n\t\t\talert('完了しました。');\n\t\t},\n\t\t'onOpenFilesDirectory': function(){\n\t\t\talert('リソースディレクトリを開きます。');\n\t\t},\n\t\t'onClickContentsLink': function( uri, data ){\n\t\t\talert('編集: ' + uri);\n\t\t},\n\t\t'onMessage': function( message ){\n\t\t\t// ユーザーへ知らせるメッセージを表示する\n\t\t\tconsole.info('message: '+message);\n\t\t},\n\t},\n\tfunction(){\n\t\t// スタンバイ完了したら呼び出されるコールバックメソッドです。\n\t\tconsole.info('standby!!');\n\t}\n);\n\u003c/script\u003e\n```\n\n\n## 更新履歴 - Change log\n\n### pickles2/lib-px2-contents-editor v2.3.0 (2025年7月29日)\n\n- Kaleflowerコンテンツの編集機能を追加した。\n- モジュール編集機能のサポートを追加した。\n- Broccoli編集時に、モジュールから `_ENV.extra.currentPageInfo` を参照できるようになった。\n- デフォルトエディタ: 画像以外のファイルを挿入できない場合がある不具合を修正した。\n\n### pickles2/lib-px2-contents-editor v2.2.9 (2025年5月9日)\n\n- Broccoli編集時に、モジュールから `_ENV.extra.topPageInfo`、 `_ENV.extra.globalMenu`、 `_ENV.extra.shoulderMenu`、 `_ENV.extra.categoryTop`、 `_ENV.extra.categorySubMenu` を参照できるようになった。\n- テーマレイアウトをBroccoli編集した場合に、HTMLが更新されない不具合を修正。\n- 依存パッケージの更新。\n\n### pickles2/lib-px2-contents-editor v2.2.8 (2025年4月3日)\n\n- デフォルトエディタ: 画像以外のファイルを挿入できるようになった。\n- `theme_id` オプション、 `layout_id` オプションを追加した。(`target_mode=theme_layout` のときに、 `page_path` オプションから指定することは非推奨になった)\n- Broccoli編集時に、モジュールから `_ENV.extra.config`、 `_ENV.extra.pageInfo`、 `_ENV.extra.breadcrumb`、 `_ENV.extra.parent`、 `_ENV.extra.bros`、 `_ENV.extra.children` を参照できるようになった。\n- その他のいくつかの不具合の修正。\n\n### pickles2/lib-px2-contents-editor v2.2.7 (2024年12月25日)\n\n- デフォルトの画像フィールドのプレースホルダ画像を更新した。\n- `noimagePlaceholder` オプションを追加した。\n\n### pickles2/lib-px2-contents-editor v2.2.6 (2024年11月1日)\n\n- Pickles Framework の言語設定で初期化するようになった。\n- 一部UIの多言語対応。\n- その他の細かいUI改善と内部コードの修正。\n- コンテンツ編集時、`$px-\u003epath_files()` によるリソースの参照は、`server_side_scripting` 権限がないユーザーにも認められるようになった。\n\n### pickles2/lib-px2-contents-editor v2.2.5 (2024年9月10日)\n\n- ブロックエディタで、ウィンドウサイズ変更時の負担を低減した。\n\n### pickles2/lib-px2-contents-editor v2.2.4 (2024年7月21日)\n\n- アペンダーを選択した状態で、「挿入」操作をするとエラーが発生する不具合を修正。\n\n### pickles2/lib-px2-contents-editor v2.2.3 (2024年3月20日)\n\n- コンテンツテンプレートのサムネイル表示に対応した。\n\n### pickles2/lib-px2-contents-editor v2.2.2 (2023年11月13日)\n\n- テーマレイアウトをBroccoli編集する時、カスタムCSS/JSの読み込みコードが出力されない不具合を修正。\n- ダークモード用のスタイルをバンドルした。\n- `appearance` オプションを追加した。\n\n### pickles2/lib-px2-contents-editor v2.2.1 (2023年9月24日)\n\n- `$px-\u003eauthorizer` の権限管理に対応。権限がない場合に、編集コードをサニタイズするようになった。\n\n### pickles2/lib-px2-contents-editor v2.2.0 (2023年8月29日)\n\n- NodeJS版の提供を廃止した。\n- デフォルトエディタ: プレビュー中のリンククリック時の挙動を改善した。\n- デフォルトエディタ: 記述したPHPがサーバー内部エラーを含んでいる場合に、プレビューのリロードが失敗したあと、修正しても復旧できない問題を修正した。\n- コンテンツテンプレート機能を追加した。\n- babycorn 経由で起動できない不具合を修正した。\n\n### pickles2-contents-editor v2.1.8 (2023年5月1日)\n\n- Broccoli編集画面で、インスタンスツリービューのトグルボタンのデザインを修正。\n\n### pickles2-contents-editor v2.1.7 (2023年4月22日)\n\n- ページが未定義のパスからのコンテンツ編集に関する不具合を修正した。\n\n### pickles2-contents-editor v2.1.6 (2023年3月11日)\n\n- デフォルトエディタ: 画像ファイルダイアログのサムネイルプレビューのUI改善。\n- ページが未定義のパスから、コンテンツの編集を初期化できるようになった。\n- テーマ編集モードの動作を改善した。\n\n### pickles2-contents-editor v2.1.5 (2023年2月11日)\n\n- テーマレイアウトをBroccoli編集する際に、Request URI Too Long になる場合がある問題を修正した。\n- デフォルトエディタで、コンテンツの変更に反応して自動保存されるようになった。\n- デフォルトエディタで、`Cmd + Shift + S` (Windows では `Ctrl + Shift + S`) で、保存して終了できるようになった。\n- デフォルトエディタで、画像ファイルを挿入できるようになった。\n- その他の細かい修正。\n\n### pickles2-contents-editor v2.1.4 (2022年12月29日)\n\n- 依存パッケージを更新。\n- カスタムフィールドの指定をフィールドIDで指定して、既存の設定をコピーできるようになった。\n- Broccoli編集画面で、 `[contenteditable]` が利用されているフィールドでバックスペースなどのキーボード操作が効かなくなる問題を修正。\n- `onOpenFilesDirectory` オプションを追加。\n\n### pickles2-contents-editor v2.1.3 (2022年11月3日)\n\n- デフォルトのエディタで、保存時にプレビューのスクロール位置を復元するようになった。\n- プレビューコンテンツ用スクリプトに関する不具合の修正。\n- 編集画面レイアウトの改善。\n- Broccoli v1.0.x に対応した。\n- Broccoli編集画面に「挿入」ボタンを追加した。\n- その他の細かい修正。\n\n### pickles2-contents-editor v2.1.2 (2022年6月5日)\n\n- 小さい画面に配慮したレイアウトの改善。\n\n### pickles2-contents-editor v2.1.1 (2022年5月22日)\n\n- `$conf-\u003epath_controot` が深いパスに設定されている場合に、異なる編集対象が選択される場合がある問題を修正。\n- その他の細かい修正。\n\n### pickles2-contents-editor v2.1.0 (2022年1月8日)\n\n- サポートするPHPのバージョンを `\u003e=7.3.0` に変更。\n- PHP 8.1 に対応した。\n\n### pickles2-contents-editor v2.0.15 (2022年1月4日)\n\n- broccoli-field-table v0.3系対応\n\n### pickles2-contents-editor v2.0.14 (2021年11月26日)\n\n- Broccoli v0.5系対応\n\n### pickles2-contents-editor v2.0.13 (2021年8月21日)\n\n- パフォーマンスに関する改善。\n- UIに関する改善。\n- その他、内部コードの細かい修正。\n\n### pickles2-contents-editor v2.0.12 (2020年2月21日)\n\n- Update: Broccoli v0.4.x\n- デフォルトエディタでリソースファイルの直接ドロップができるようになった。\n- その他の細かい修正。\n\n### pickles2-contents-editor v2.0.11 (2020年8月12日)\n\n- defaultエディタで、行の折り返しのモードを切り替えられるようになった。\n- Broccoliエディタで、ビューポートサイズを変更できるようになった。\n- Broccoliエディタで、選択したインスタンスをJSONファイルに出力できるようになった。\n- Broccoliエディタの新しい設定項目 `fieldConfig` に対応。\n- Broccoliエディタの新しい設定項目 `userStorage` に対応。\n- Broccoliエディタの新しい設定項目 `droppedFileOperator` に対応。\n\n### pickles2-contents-editor v2.0.10 (2020年1月2日)\n\n- PHP 7.4 に対応した。\n\n### pickles2-contents-editor v2.0.9 (2019年12月13日)\n\n- プレビューの読み込みに 30秒以上かかる場合、タイムアウトを発生させて強制的に編集画面へ移行するようになった。\n\n### pickles2-contents-editor v2.0.8 (2019年8月11日)\n\n- 内部のライブラリ構成を調整した。\n- タッチ端末でのスクロールに関する問題を修正。\n\n### pickles2-contents-editor v2.0.7 (2019年7月10日)\n\n- 編集中のプレビューにGETパラメータ `PICKLES2_CONTENTS_EDITOR` を付加するようになった。\n- `vendor` ディレクトリ中のカスタムフィールドを自動的に検索して読み込むようになった。\n- テーマをBroccoliエディタモードで編集するとき、カスタムCSSとJavaScriptを記述できるようになった。\n\n### pickles2-contents-editor v2.0.6 (2019年6月15日)\n\n- モジュールパレットの表示サイズの調整が少しズレる問題を修正。\n- コンテンツの作成をキャンセルできるようになった。\n\n\n## License\n\nMIT License\n\n\n## Author\n\n- Tomoya Koyanagi \u003ctomk79@gmail.com\u003e\n- website: \u003chttps://www.pxt.jp/\u003e\n- Twitter: @tomk79 \u003chttps://twitter.com/tomk79/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpickles2%2Flib-px2-contents-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpickles2%2Flib-px2-contents-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpickles2%2Flib-px2-contents-editor/lists"}