diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 48958a005..4ddc4b7b9 100755 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -3,10 +3,12 @@ namespace App\Http\Controllers; use App\Module\Base; +use App\Module\Ihttp; use App\Tasks\AutoArchivedTask; use App\Tasks\DeleteTmpTask; use App\Tasks\EmailNoticeTask; use Arr; +use Cache; use Hhxsv5\LaravelS\Swoole\Task\Task; use Redirect; use Request; @@ -211,6 +213,28 @@ class IndexController extends InvokeController return abort(404); } + /** + * Drawio 图标搜索 + * @return array|mixed + */ + public function drawio__iconsearch() + { + $query = Request::input('q'); + $page = Request::input('p'); + $size = Request::input('c'); + $url = "https://app.diagrams.net/iconSearch?q={$query}&p={$page}&c={$size}"; + $result = Cache::remember("drawioIconsearch::" . md5($url), now()->addDays(15), function () use ($url) { + return Ihttp::ihttp_get($url); + }); + if (Base::isSuccess($result)) { + return $result['data']; + } + return [ + 'icons' => [], + 'total_count' => 0 + ]; + } + /** * 提取所有中文 * @return array|string diff --git a/docker/drawio/webapp/README.md b/docker/drawio/webapp/README.md index a13039436..f1f82f688 100644 --- a/docker/drawio/webapp/README.md +++ b/docker/drawio/webapp/README.md @@ -11,7 +11,14 @@ - `EmbedFile.prototype.getTitle=...` 改 `EmbedFile.prototype.getTitle=function(){return this.desc.title||(urlParams.title?decodeURIComponent(urlParams.title):"")}` - `c.insertTemplateEnabled&&!c.isOffline()&&this.addMenuItems(b,["insertTemplate"],d)` 改 `c.insertTemplateEnabled&&this.addMenuItems(b,["insertTemplate"],d)` - `390:270` 改 `390:285` +- `!this.editorUi.isOffline()&&d.length<=c/4?(f=b-Math.ceil((e-c/4)/c),mxUtils.get(ICONSEARCH_PATH` 改 `d.length<=c/4?(f=b-Math.ceil((e-c/4)/c),mxUtils.get(ICONSEARCH_PATH` ## index.html - 隐藏加载中的提示 +- 加入 +```js +window.EXPORT_URL = window.location.origin + "/drawio/export/"; +window.DRAWIO_LIGHTBOX_URL = window.location.origin + "/drawio/webapp"; +setInterval(function() {window.ICONSEARCH_PATH = window.location.origin + "/drawio/iconsearch";}, 1000) +``` diff --git a/docker/drawio/webapp/index.html b/docker/drawio/webapp/index.html index 89affb167..666d2bdd0 100644 --- a/docker/drawio/webapp/index.html +++ b/docker/drawio/webapp/index.html @@ -19,6 +19,7 @@