Skip to content

Commit

Permalink
added icon, fixed custom svg functionality, fixed target, added links…
Browse files Browse the repository at this point in the history
… counter
  • Loading branch information
umaidshahid committed Jun 5, 2024
1 parent 124771e commit 5a62ed4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion a11y-links.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions icons/links.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions scratch/compiled/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
'use strict';

var setup = function (editor, url) {
editor.ui.registry.addIcon('custom-links-icon', '<img src="/icons/links.svg " style="height: 25px; width: 25px;"/>');
editor.ui.registry.addButton('a11y-links', {
icon: 'link',
icon: 'custom-links-icon',
tooltip: 'Accessible Links',
onAction: function () {
var links = editor.dom.select('a');
Expand Down Expand Up @@ -79,7 +80,7 @@
items: [
{
type: 'htmlpanel',
html: '<p id="link-display" style="font-family: Courier Sans;">'.concat(editor.serializer.serialize(links[currentIndex]), '</p>')
html: '<p id="link-display" style="font-family: Courier Sans;">'.concat(editor.serializer.serialize(links[currentIndex]), ' <span style="font-weight: bold;">(Link ').concat(currentIndex + 1, ' of ').concat(links.length, ')</span></p>')
},
{
type: 'htmlpanel',
Expand Down Expand Up @@ -222,22 +223,24 @@
}
],
onChange: function (dialogApi, details) {
if (details.name.startsWith('noSymbol') || details.name.startsWith('downArrow') || details.name.startsWith('topPage') || details.name.startsWith('neArrow') || details.name.startsWith('rightArrow') || details.name.startsWith('overlappingSquares') || details.name.startsWith('customSvgSymbol')) {
if (details.name.startsWith('noSymbol') || details.name.startsWith('downArrow') || details.name.startsWith('topPage') || details.name.startsWith('neArrow') || details.name.startsWith('rightArrow') || details.name.startsWith('overlappingSquares')) {
var symbolCheckboxes = [
'noSymbol',
'downArrow',
'topPage',
'neArrow',
'rightArrow',
'overlappingSquares',
'customSvgSymbol'
'overlappingSquares'
];
symbolCheckboxes.forEach(function (symbol) {
var _a;
if (symbol !== details.name) {
dialogApi.setData((_a = {}, _a[symbol] = false, _a));
}
});
}
if (details.name === 'customSvgSymbol') {
dialogApi.setData({ customSvgSymbol: details.value });
} else if (details.name.startsWith('srText')) {
var srTextCheckboxes = [
'srTextNone',
Expand Down Expand Up @@ -289,6 +292,7 @@
}
case 'removeTarget': {
editor.dom.setAttrib(link, 'target', null);
editor.dom.setAttrib(link, 'rel', null);
break;
}
case 'insertTarget': {
Expand Down
Loading

0 comments on commit 5a62ed4

Please sign in to comment.