mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-06 17:37:06 +00:00
perf: 流程图支持搜索远程图标
This commit is contained in:
parent
abad2c2cc9
commit
e161912496
@ -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
|
||||
|
||||
@ -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)
|
||||
```
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
<script type="text/javascript">
|
||||
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)
|
||||
|
||||
/**
|
||||
* URL Parameters and protocol description are here:
|
||||
|
||||
2
docker/drawio/webapp/js/app.min.js
vendored
2
docker/drawio/webapp/js/app.min.js
vendored
@ -3844,7 +3844,7 @@ this.addCumulusPalette();this.addCitrixPalette();this.addGCP2Palette();this.addG
|
||||
this.addFluidPowerPalette();this.addGMDLPalette();this.addPidPalette(e,c);this.addThreatModelingPalette();this.addWebIconsPalette();this.addWebLogosPalette();this.addSignsPalette(b,c);this.showEntries();null!=this.createdSearchIndex&&console.log("searchFileData",Graph.compress(JSON.stringify(this.createdSearchIndex)))};if("1"==urlParams.createindex){var c=Sidebar.prototype.addStencilPalette;Sidebar.prototype.addStencilPalette=function(a,b,d,e,f,n,q,p,r,t){c.apply(this,arguments);q=null!=q?q:1;mxStencilRegistry.loadStencilSet(d,
|
||||
mxUtils.bind(this,function(c,b,d,g,h){if(null!=this.createdSearchIndex&&null==f||0>mxUtils.indexOf(f,b))c={style:"shape="+c+b+e,w:Math.round(g*q),h:Math.round(h*q)},b=null!=p?p[b]:null,null!=b&&(c.tags=b),null!=t&&(c.id=t,c.lib=a),this.createdSearchIndex.push(c)}),!0)}}Sidebar.prototype.extractIconsFromResponse=function(a,c){for(var b=0;b<a.icons.length;b++){for(var d=a.icons[b].raster_sizes,e=d.length-1;0<e&&128<d[e].size;)e--;var f=d[e].size,d=d[e].formats[0].preview_url;null!=f&&null!=d&&mxUtils.bind(this,
|
||||
function(a,b){c.push(mxUtils.bind(this,function(){return this.createVertexTemplate("shape=image;html=1;verticalAlign=top;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;imageAspect=0;aspect=fixed;image="+b,a,a,"")}))})(f,d)}};var d=Sidebar.prototype.searchEntries;Sidebar.prototype.searchEntries=function(a,c,b,e,f){var g=e;null!=this.searchIndexData&&(this.addSearchIndex(JSON.parse(Graph.decompress(this.searchIndexData))),this.searchIndexData=null);null!=ICONSEARCH_PATH&&(e=mxUtils.bind(this,
|
||||
function(d,e,f,h){!this.editorUi.isOffline()&&d.length<=c/4?(f=b-Math.ceil((e-c/4)/c),mxUtils.get(ICONSEARCH_PATH+"?q="+encodeURIComponent(a)+"&p="+f+"&c="+c,mxUtils.bind(this,function(a){try{if(200<=a.getStatus()&&299>=a.getStatus()&&null!=a.getText()&&0<a.getText().length)try{var f=JSON.parse(a.getText());null==f||null==f.icons?(g(d,e,!1,h),this.editorUi.handleError(f)):(this.extractIconsFromResponse(f,d),g(d,(b-1)*c+d.length,f.icons.length==c,h))}catch(v){g(d,e,!1,h),this.editorUi.handleError(v)}else g(d,
|
||||
function(d,e,f,h){d.length<=c/4?(f=b-Math.ceil((e-c/4)/c),mxUtils.get(ICONSEARCH_PATH+"?q="+encodeURIComponent(a)+"&p="+f+"&c="+c,mxUtils.bind(this,function(a){try{if(200<=a.getStatus()&&299>=a.getStatus()&&null!=a.getText()&&0<a.getText().length)try{var f=JSON.parse(a.getText());null==f||null==f.icons?(g(d,e,!1,h),this.editorUi.handleError(f)):(this.extractIconsFromResponse(f,d),g(d,(b-1)*c+d.length,f.icons.length==c,h))}catch(v){g(d,e,!1,h),this.editorUi.handleError(v)}else g(d,
|
||||
e,!1,h)}catch(v){g(d,e,!1,h),this.editorUi.handleError(v)}},function(){g(d,e,!1,h)}))):g(d,e,f||!this.editorUi.isOffline(),h)}));d.apply(this,arguments)};var f=Sidebar.prototype.itemClicked;Sidebar.prototype.itemClicked=function(a,c,b){var d=this.editorUi.editor.graph,e=!1;if(null!=a&&1==d.getSelectionCount()&&d.getModel().isVertex(a[0])){var g=d.cloneCell(a[0]);if(d.getModel().isEdge(d.getSelectionCell())&&null==d.getModel().getTerminal(d.getSelectionCell(),!1)&&d.getModel().isVertex(g)){d.getModel().beginUpdate();
|
||||
try{var h=d.view.getState(d.getSelectionCell());if(null!=h){var k=d.view.translate,r=d.view.scale,t=h.absolutePoints[h.absolutePoints.length-1];g.geometry.x=t.x/r-k.x-g.geometry.width/2;g.geometry.y=t.y/r-k.y-g.geometry.height/2}d.addCell(g);d.getModel().setTerminal(d.getSelectionCell(),g,!1);null!=b&&mxEvent.isShiftDown(b)||d.fireEvent(new mxEventObject("cellsInserted","cells",[g]))}catch(u){this.editorUi.handleError(u)}finally{d.getModel().endUpdate()}d.scrollCellToVisible(g);d.setSelectionCell(g);
|
||||
e=!0}}e||f.apply(this,arguments)}})();(function(){Sidebar.prototype.addActiveDirectoryPalette=function(){this.setCurrentSearchEntryLibrary("active_directory");var a=[this.createVertexTemplateEntry("aspect=fixed;perimeter=ellipsePerimeter;html=1;align=center;shadow=0;dashed=0;spacingTop=3;image;image=img/lib/active_directory/active_directory.svg;",50,42.5,"","Active Directory",!1,null,this.getTagsForStencil("ms active directory ","active directory","ibm").join(" ")),this.createVertexTemplateEntry("aspect=fixed;perimeter=ellipsePerimeter;html=1;align=center;shadow=0;dashed=0;spacingTop=3;image;image=img/lib/active_directory/cd_dvd.svg;",
|
||||
|
||||
2
electron/electron.js
vendored
2
electron/electron.js
vendored
@ -444,7 +444,7 @@ ipcMain.on('updateCheckAndDownload', (event, args) => {
|
||||
ipcMain.on('updateQuitAndInstall', (event) => {
|
||||
event.returnValue = "ok"
|
||||
willQuitApp = true
|
||||
setTimeout(() => autoUpdater.quitAndInstall(), 1)
|
||||
setTimeout(() => autoUpdater.quitAndInstall(true, true), 1)
|
||||
})
|
||||
|
||||
//================================================================
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user