Skip to content

Commit 4f7dd14

Browse files
committed
[ADD] evo links plugin
1 parent 33ce062 commit 4f7dd14

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

public/js/link-evo.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@
14091409
timer: null,
14101410
updating: false,
14111411
iconRegistered: false,
1412-
iconName: 'evo-file'
1412+
iconName: 'link'
14131413
};
14141414
const showEvoNotice = (text) => {
14151415
if (editor.notificationManager && typeof editor.notificationManager.open === 'function') {
@@ -1559,11 +1559,22 @@
15591559
results.forEach((item) => {
15601560
const text = item.title || item.pagetitle || item.alias || String(item.id);
15611561
const value = String(item.id);
1562-
if (!evoState.iconRegistered && item.icon && tinymce?.IconManager?.add) {
1563-
tinymce.IconManager.add(evoState.iconName, item.icon);
1564-
evoState.iconRegistered = true;
1562+
let iconName = 'link';
1563+
if (item && typeof item.icon === 'string' && item.icon.trim()) {
1564+
const rawIcon = item.icon.trim();
1565+
if (rawIcon.indexOf('<svg') !== -1 && tinymce?.IconManager?.add) {
1566+
if (!evoState.iconRegistered && evoState.iconName !== 'link') {
1567+
tinymce.IconManager.add(evoState.iconName, rawIcon);
1568+
evoState.iconRegistered = true;
1569+
}
1570+
if (evoState.iconRegistered) {
1571+
iconName = evoState.iconName;
1572+
}
1573+
} else {
1574+
iconName = rawIcon;
1575+
}
15651576
}
1566-
items.push({ text, value, icon: evoState.iconRegistered ? evoState.iconName : 'none' });
1577+
items.push({ text, value, icon: iconName });
15671578
map[value] = item;
15681579
});
15691580
evoState.searchItems = items;

src/Http/routes.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,7 @@
5959
return strcmp($aTitle, $bTitle);
6060
});
6161

62-
$iconHtml = '';
63-
if (function_exists('svg')) {
64-
try {
65-
$iconHtml = svg('tabler-file')->toHtml();
66-
} catch (\Throwable $e) {
67-
$iconHtml = '';
68-
}
69-
}
62+
$iconHtml = 'link';
7063

7164
$output = [];
7265
foreach ($rows as $row) {

0 commit comments

Comments
 (0)