Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 5: enhanced block editing and self-hosting #224

Open
wants to merge 320 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
320 commits
Select commit Hold shift + click to select a range
22f0364
use forward/back language instead of up/down
mlwilkerson Jul 9, 2024
a665540
handle power transforms rotation
mlwilkerson Jul 9, 2024
d28c214
re-fix the inline SVG mutation observer
mlwilkerson Jul 10, 2024
d3510b7
tweak style when hovering over inline format API SVG
mlwilkerson Jul 10, 2024
4944820
add mask support
mlwilkerson Jul 10, 2024
5d6df89
fix typos in size change labels
mlwilkerson Jul 10, 2024
894474a
re-write the inlineSvgFormat Edit component
mlwilkerson Jul 10, 2024
b1c7534
use div for block type icons and span for inline format SVGs
mlwilkerson Jul 11, 2024
ac237af
add .rgignore for ripgrep
mlwilkerson Jul 11, 2024
6804008
use 0.8.0-1 pre-release of fa-icon chooser
mlwilkerson Jul 11, 2024
23e49c0
re-build production icon chooser bundle
mlwilkerson Jul 11, 2024
2a4d416
rebuild block-editor production bundle
mlwilkerson Jul 11, 2024
f338f24
re-build class-editor production bundle
mlwilkerson Jul 11, 2024
e70129a
rebuild admin production bundle
mlwilkerson Jul 11, 2024
70fdba2
add needed icon assets
frrrances Jul 12, 2024
22e0704
remove inline-block display from block-editor icon
frrrances Jul 12, 2024
ee50efa
update package-lock for block-editor
mlwilkerson Jul 15, 2024
2701535
re-org and bugfix for mutation observer
mlwilkerson Jul 16, 2024
364ca87
rename mutation observer script
mlwilkerson Jul 16, 2024
c0c78df
tweak mutation observer
mlwilkerson Jul 16, 2024
be2b5fd
WIP: checkpoint for inline svg
mlwilkerson Jul 16, 2024
120832c
refine mutation observer again
mlwilkerson Jul 16, 2024
feb6361
use create from html instead
mlwilkerson Jul 16, 2024
4572fae
cleanup
mlwilkerson Jul 16, 2024
a56e97b
renaming as richTextIcon
mlwilkerson Jul 16, 2024
e37ae25
use insertObject to get the object replacement text instead of hardco…
mlwilkerson Jul 17, 2024
82d5967
fix the focus control
mlwilkerson Jul 17, 2024
4f9aa82
renaming classes
mlwilkerson Jul 17, 2024
89a4452
rebuild block-editor bundle
mlwilkerson Jul 17, 2024
c79717c
change the toolbar icon
mlwilkerson Jul 17, 2024
a65c673
clean up rich text icon and class naming
mlwilkerson Jul 17, 2024
8cc40de
tweak the mutation observer to be constrained by the new rich text class
mlwilkerson Jul 17, 2024
1e49537
rebuild block-editor bundle
mlwilkerson Jul 17, 2024
20982c8
add SCRIPT_DEBUG to debugging config
mlwilkerson Jul 17, 2024
469d357
fix alignment of object replacement chars and replacement formats
mlwilkerson Jul 17, 2024
6dcd011
rebuild block-editor bundle
mlwilkerson Jul 17, 2024
cb50d24
inital cuts to remove layer and mask support for now
mlwilkerson Jul 17, 2024
56ceed3
remove onKeyDown event handling from toolbar button
mlwilkerson Jul 17, 2024
b75206a
more cleanup
mlwilkerson Jul 17, 2024
e637fab
update renderIcon to parameterize the wrapperElement
mlwilkerson Jul 17, 2024
1f1fb37
refactoring transformation of icon chooser select event into iconDefi…
mlwilkerson Jul 17, 2024
0150ed2
use react component to render rich text icon as well to be DRY
mlwilkerson Jul 17, 2024
2e60ca7
clean up old SVG rendering
mlwilkerson Jul 17, 2024
71aeffb
remove the mutation observer: no longer needed
mlwilkerson Jul 17, 2024
96dd2cc
fix rich text icon popover anchor
mlwilkerson Jul 18, 2024
ac580f0
rebuild block-editor bundle
mlwilkerson Jul 18, 2024
28dba72
Start of icon styling UI (#222)
frrrances Jul 18, 2024
c81c4eb
rebuild block-editor bundle
mlwilkerson Jul 18, 2024
ad191ce
WIP: wiring up richTextIcon to use the IconModifier UI
mlwilkerson Jul 18, 2024
0cae4d9
refactoring
mlwilkerson Jul 18, 2024
c4788a3
handle rich text icon replacement
mlwilkerson Jul 18, 2024
bf7d12a
preserve styling when changing rich text icon
mlwilkerson Jul 18, 2024
cec1310
render nothing when no iconLayers are present
mlwilkerson Jul 18, 2024
7961ff6
handle power transforms for rich text icons
mlwilkerson Jul 18, 2024
dcf4ec6
only pick valid transform props
mlwilkerson Jul 18, 2024
47933db
use DOMParser instead of setting innerHTML
mlwilkerson Jul 18, 2024
9661a0c
remove a lot more layer and mask settings stuff
mlwilkerson Jul 18, 2024
b7a5f15
rebuild block-editor bundle
mlwilkerson Jul 18, 2024
f57c1e1
remove obsolete OptionalTooltip
mlwilkerson Jul 19, 2024
fdc388a
WIP: initial wire-up of tab panel
mlwilkerson Jul 19, 2024
6701d60
use icons
mlwilkerson Jul 19, 2024
8c2dd1e
rebuild block-editor bundle
mlwilkerson Jul 19, 2024
1d52efa
WIP: initial refactor of SettingsTabPanel
mlwilkerson Jul 19, 2024
dc03778
WIP: re-working sizing in terms of power transforms
mlwilkerson Jul 19, 2024
8f02868
re-work rotation and custom rotation in terms of power transforms
mlwilkerson Jul 19, 2024
94da769
wire-up selected class for rotation
mlwilkerson Jul 19, 2024
34f0df5
add temporary style for fawp-selected
mlwilkerson Jul 19, 2024
4909fe3
rename settings as editorSettings
mlwilkerson Jul 19, 2024
6c1e2f8
remove obsolete setSize
mlwilkerson Jul 19, 2024
cd0599f
remove obsolete setRotation
mlwilkerson Jul 19, 2024
8921dff
WIP: initial Colors subpanel
mlwilkerson Jul 19, 2024
dc2ca8d
get custom color selection working
mlwilkerson Jul 19, 2024
78c9a0e
refactor color setting logic
mlwilkerson Jul 19, 2024
6ce68e9
tweak temp fawp-selected rule
mlwilkerson Jul 19, 2024
90b74c0
tweak temp fawp-selected style again
mlwilkerson Jul 19, 2024
c341484
wireup selected class for size buttons
mlwilkerson Jul 19, 2024
93d6650
migrate flipping to use power transforms
mlwilkerson Jul 19, 2024
8282c24
remove some old stuff
mlwilkerson Jul 19, 2024
67240ab
rebuild block-editor bundle
mlwilkerson Jul 19, 2024
c63d83d
clean up some obsolete stuf
mlwilkerson Jul 19, 2024
65e6610
handle fawp-selected for flips
mlwilkerson Jul 19, 2024
44eeb43
wire-up animation button selected state
mlwilkerson Jul 19, 2024
985ff40
add temporary styling for animation button selection
mlwilkerson Jul 19, 2024
967611d
rebuild block-editor bundle
mlwilkerson Jul 19, 2024
1190c1b
remove obsolete CSS rules for selected-layer class
mlwilkerson Jul 19, 2024
c589a4e
remove obsolete consts
mlwilkerson Jul 19, 2024
5ba1e7d
WIP: refactoring
mlwilkerson Jul 20, 2024
222f762
rebuild block-editor bundle
mlwilkerson Jul 20, 2024
e89b66a
WIP: IconSizer
mlwilkerson Jul 22, 2024
c2d853c
refactor IconSizer
mlwilkerson Jul 22, 2024
37c573b
finish wiring up new IconSizer
mlwilkerson Jul 22, 2024
2a7f16e
rebuild block-editor bundle
mlwilkerson Jul 22, 2024
7c97d4a
remove obsolete resetSize in updateTransform()
mlwilkerson Jul 22, 2024
b58a9b6
rebuild block-editor bundle
mlwilkerson Jul 22, 2024
8d96ad5
add standard class names
frrrances Jul 23, 2024
ae68864
cleanup
frrrances Jul 23, 2024
48ad4df
switch back to FontSizePicker
frrrances Jul 23, 2024
12a3e01
remove unnecessary kses filter
mlwilkerson Jul 23, 2024
05ffa35
add the font_awesome_skip_enqueue_kit filter
mlwilkerson Jul 23, 2024
af29688
WIP: add SVG support styles manager class
mlwilkerson Jul 23, 2024
f8cd72d
refactor skip_enqeue_kit()
mlwilkerson Jul 23, 2024
e400876
initial wire-up of size changing
mlwilkerson Jul 23, 2024
6595a6b
refactor size setting
mlwilkerson Jul 23, 2024
d927fef
rebuild block-editor bundle
mlwilkerson Jul 23, 2024
7b935a3
WIP: initial wire-up of setup_selfhosting for svg support styles
mlwilkerson Jul 23, 2024
3401eb8
add pict model
mlwilkerson Jul 24, 2024
27d59a1
WIP: re-work setup for loading additional svg support styles
mlwilkerson Jul 24, 2024
cb27321
complete initial happy path wire-up of loading additional svg styles
mlwilkerson Jul 24, 2024
d84e9d8
add filters the alpha theme
mlwilkerson Jul 24, 2024
69a3598
remove integrity_key condition
mlwilkerson Jul 24, 2024
6b9813d
migrate admin bundle to use createRoot()
mlwilkerson Jul 24, 2024
ff9ed74
migrate conflict detection React mount to use createRoot()
mlwilkerson Jul 24, 2024
5e7803d
re-work conditional enqueue of kit and associated conflict detection …
mlwilkerson Jul 24, 2024
12f2179
rebuild admin bundle
mlwilkerson Jul 24, 2024
6aec76e
migrate classic-editor React mount to use createRoot
mlwilkerson Jul 24, 2024
a5b20dd
rebuild classic-editor bundle
mlwilkerson Jul 24, 2024
5502c0b
color palette styling
frrrances Jul 24, 2024
3c231ec
fix aria-selected for colors and import ColorPicker
mlwilkerson Jul 24, 2024
55a6072
rebuild block-editor bundle
mlwilkerson Jul 24, 2024
6c90267
fix color picker logic
mlwilkerson Jul 24, 2024
df97a4e
rebuild block-editor bundle
mlwilkerson Jul 24, 2024
65a9536
fix color picker and its default
mlwilkerson Jul 24, 2024
2a23c45
rebuild block-editor bundle
mlwilkerson Jul 24, 2024
7d1b97b
guard invocations of md5(): require only string arg
mlwilkerson Jul 24, 2024
c2bd436
remove obsolete css file
mlwilkerson Jul 24, 2024
d6caae0
fix popover anchor when block has only a rich text icon
mlwilkerson Jul 24, 2024
be70bee
pass through context to IconModifier from richText
mlwilkerson Jul 24, 2024
fe60c40
rebuild block-editor bundle
mlwilkerson Jul 24, 2024
a7a8b1e
reorganize attributes state for richText icon
mlwilkerson Jul 24, 2024
e3527d9
fix change of icon after richText icon attributes reorg
mlwilkerson Jul 24, 2024
2664ee7
rebuild block-editor bundle
mlwilkerson Jul 24, 2024
3fa5a2e
move rich text toolbar button
mlwilkerson Jul 24, 2024
4586a86
set isActive for the toolbar button based on isFormatIconFocused
mlwilkerson Jul 24, 2024
dd96275
change how rich text icons are inserted so as not to overwrite other …
mlwilkerson Jul 24, 2024
bb6e547
fix icon replacement: distinguishing between initial placement versus…
mlwilkerson Jul 24, 2024
2ab384e
change insert/replace logic with isObjectActive
mlwilkerson Jul 25, 2024
b65140f
rebuild block-editor bundle
mlwilkerson Jul 25, 2024
b35480f
remove popoverAnchor fly-away hack now that we have isObjectActive
mlwilkerson Jul 25, 2024
f0845ed
rebuild block-editor bundle
mlwilkerson Jul 25, 2024
4e81458
position custom color picker
frrrances Jul 25, 2024
7abe59d
remove obsolete webpack config comments
mlwilkerson Jul 25, 2024
e2084b9
remove obsolete fa-icon-chooser-react dep from admin bundle
mlwilkerson Jul 25, 2024
f8a9cf7
remove default fontSize setting in inline style
mlwilkerson Jul 25, 2024
7778111
fix flying t-shirt size highlights by moving modal out of the popover
mlwilkerson Jul 25, 2024
fe51039
include backgroundColor in context passed into the modal
mlwilkerson Jul 25, 2024
48c2548
rebuild block-editor bundle
mlwilkerson Jul 25, 2024
4ecf123
change the rich text icon class name
mlwilkerson Jul 25, 2024
cc34b1f
add common class to rich text wrapper element
mlwilkerson Jul 25, 2024
2bb4489
add common wrapper class to block icon
mlwilkerson Jul 25, 2024
d72c4ad
rebuild block-editor bundle
mlwilkerson Jul 25, 2024
8613cab
rebuild block-editor bundle
mlwilkerson Jul 25, 2024
20641d9
adjust class names, cleanup, and add close to color picker
frrrances Jul 25, 2024
90b1ffc
remove redundant size header
frrrances Jul 25, 2024
b9ecd57
fixup on popover, adjust preview w background
frrrances Jul 25, 2024
0d30843
update rich text class
mlwilkerson Jul 25, 2024
f0327d5
rebuild block-editor bundle
mlwilkerson Jul 25, 2024
3abdaba
tweak metadata names in block registration
mlwilkerson Jul 25, 2024
4074e86
fix building and loading of editorStyles
mlwilkerson Jul 25, 2024
664a724
add inline_style registration of base styles for both block and rich …
mlwilkerson Jul 25, 2024
39c3df9
refactor init and conditional loading of block assets
mlwilkerson Jul 25, 2024
ba92440
change enqueue rules for svg styles
mlwilkerson Jul 26, 2024
5e913a6
tweak theme alpha functions test code
mlwilkerson Jul 26, 2024
fb7a71c
rebuild block-editor bundle
mlwilkerson Jul 26, 2024
baac703
fix derivation of fontSize attribute for re-styling sized richText icon
mlwilkerson Jul 26, 2024
3578a13
rebuild block-editor bundle
mlwilkerson Jul 26, 2024
f5220d9
update deriveAttributes to use allow list for picking style properties
mlwilkerson Jul 26, 2024
a68f16a
remove some "supports" from block.json
mlwilkerson Jul 26, 2024
8070226
remove obsolete commented code
mlwilkerson Jul 26, 2024
c10a330
rebuild block-editor bundle
mlwilkerson Jul 26, 2024
f692699
make flip reset match rotation reset, having no selection indicator
mlwilkerson Jul 26, 2024
d8f1b74
add alignment dropdown menu
mlwilkerson Jul 26, 2024
f8396c5
rebuild block-editor bundle
mlwilkerson Jul 26, 2024
dd90626
add @wordpress/icons to package.json
mlwilkerson Jul 26, 2024
48e4024
add justification attribute to block icon
mlwilkerson Jul 26, 2024
893273c
rebuild block-editor bundle
mlwilkerson Jul 26, 2024
c7ec208
adjust alignment toolbar buttons
frrrances Jul 26, 2024
73491d7
improve loading of CSS
mlwilkerson Jul 26, 2024
c68c10d
rebuild block-editor bundle
mlwilkerson Jul 26, 2024
87cacd8
config prettier and auto-format
mlwilkerson Jul 26, 2024
f2c9336
WIP: fixing linter warnings and adding i18n
mlwilkerson Jul 27, 2024
aa4475b
remove obsolete iconSizer
mlwilkerson Jul 27, 2024
ad7f8a5
WIP: fix linting and isAnimationSelected for No Animation
mlwilkerson Jul 27, 2024
863e593
WIP: clean up and linting
mlwilkerson Jul 27, 2024
1c2df5b
more linting
mlwilkerson Jul 27, 2024
1bcaca0
rebuild block-editor bundle
mlwilkerson Jul 27, 2024
caadb66
fix deprecation warning by using ToolbarDropdownMenu
mlwilkerson Jul 27, 2024
321a025
rebuild block-editor bundle
mlwilkerson Jul 27, 2024
5753c7e
add prettierrc to admin bundle
mlwilkerson Jul 28, 2024
e9f6c1e
auto-formatting admin bundle
mlwilkerson Jul 28, 2024
b60c166
rebuild admin bundle
mlwilkerson Jul 28, 2024
dde37f0
add prettierrc for classic-editor bundle
mlwilkerson Jul 28, 2024
b333c00
auto-formatting classic-editor source
mlwilkerson Jul 28, 2024
bfdba35
phpcbf auto-formatting
mlwilkerson Jul 28, 2024
141e1cd
php auto-formatting
mlwilkerson Jul 28, 2024
df5b707
move phpcs def to help with auto-formatting in neovim
mlwilkerson Jul 29, 2024
41b3d79
gitignore php-cs-fixer cache
mlwilkerson Jul 29, 2024
3bb1f4d
add phpactor config for neovim
mlwilkerson Jul 29, 2024
62cb96a
wire-up an example in JS
mlwilkerson Jul 26, 2024
c42981c
rebuild block-editor bundle with example
mlwilkerson Jul 26, 2024
1d129cb
update block add hover preview
frrrances Jul 30, 2024
4c6b22f
rebuild block-editor bundle
mlwilkerson Jul 30, 2024
84576b6
return svg styles module as a singleton to make it mockable
mlwilkerson Jul 30, 2024
8809994
add mock to config controller test
mlwilkerson Jul 30, 2024
cdf1856
update deps in composer.json
mlwilkerson Jul 30, 2024
95247b6
auto-formatting
mlwilkerson Jul 30, 2024
7be40f4
TEMP: disable phpcbf for font-awesome.php
mlwilkerson Jul 30, 2024
c9ffc2c
auto-formatting
mlwilkerson Jul 30, 2024
45828de
remove configurations for obsolete versions of php or WordPress
mlwilkerson Jul 30, 2024
3b39366
fix loader test to run on init
mlwilkerson Jul 31, 2024
2393f72
phpcs fixes
mlwilkerson Jul 31, 2024
52de0c2
phpcs cleanup
mlwilkerson Jul 31, 2024
64c99ca
use php8.2 for phpcs
mlwilkerson Aug 1, 2024
a49c6d1
maybe exit before sourcing in other code
mlwilkerson Aug 1, 2024
5212553
add some more exits if accessed directly
mlwilkerson Aug 1, 2024
4023b2a
auto-formatting
mlwilkerson Aug 1, 2024
9cd170d
migrate to using WP_Filesystem methods for filesystem access
mlwilkerson Aug 1, 2024
97ab23c
ignore phpcs warning for file system function in test code
mlwilkerson Aug 1, 2024
afab9e1
use wp_mkdir_p for creating the svg styles subdir
mlwilkerson Aug 2, 2024
6401f05
add self-hosting exceptions
mlwilkerson Aug 2, 2024
72c7145
phpcs cleanup
mlwilkerson Aug 2, 2024
c98bee8
update dist zip-building script
mlwilkerson Aug 2, 2024
f80232b
update composer.json for release build steps
mlwilkerson Aug 2, 2024
66c7f56
update release steps in DEVELOPMENT.md
mlwilkerson Aug 2, 2024
d4a129c
Add a try again message for token endpoint failure
mlwilkerson Aug 2, 2024
a34bb86
remove v3deprecation code from admin bundle
mlwilkerson Aug 2, 2024
e6a1e3f
remove v3deprecation code from back end
mlwilkerson Aug 2, 2024
9144938
rebuild admin bundle
mlwilkerson Aug 2, 2024
41916f2
update version for conflict detection script
mlwilkerson Aug 2, 2024
e2a381a
update min WP and PHP requirements
mlwilkerson Aug 2, 2024
fe4caa6
remove obsolete enableIconChooser
mlwilkerson Aug 2, 2024
6bc6fcc
rebuild admin bundle
mlwilkerson Aug 2, 2024
3e35bb8
remove obsolete dist packing code
mlwilkerson Aug 2, 2024
1e24480
remove compat-js bundle
mlwilkerson Aug 2, 2024
21ac410
register js bundle scripts before enqueue
mlwilkerson Aug 2, 2024
aa3b839
load classic-editor bundle only when tiny_mce is being loaded
mlwilkerson Aug 2, 2024
20063c1
update admin bundle version and build
mlwilkerson Aug 5, 2024
ef1742d
update block-editor bundle version
mlwilkerson Aug 5, 2024
f6e59f5
update classic-editor bundle version
mlwilkerson Aug 5, 2024
edf482a
update icon-chooser bundle version and build
mlwilkerson Aug 5, 2024
8243353
bump version to 5.0.0-alpha1
mlwilkerson Aug 5, 2024
88cc4e5
rebuild docs
mlwilkerson Aug 5, 2024
91876e0
update package-lock.json for each js bundle
mlwilkerson Aug 6, 2024
1a07d19
Bug fixes and cleanup (#225)
mlwilkerson Aug 9, 2024
dbb8091
prepare for 5.0.0-alpha1
mlwilkerson Aug 9, 2024
d32cbd0
run tests on push to any branc
mlwilkerson Aug 9, 2024
316c58a
fix lodash dev deps for jest tests
mlwilkerson Aug 10, 2024
36c1e8f
add eslint dep for react
mlwilkerson Aug 10, 2024
b691390
remove unused var
mlwilkerson Aug 10, 2024
c9ae274
rebuild admin bundle
mlwilkerson Aug 10, 2024
37dd568
Release 5.0.0-alpha2
mlwilkerson Aug 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use div for block type icons and span for inline format SVGs
  • Loading branch information
mlwilkerson committed Jul 11, 2024
commit b1c7534a34542e104c4a0a914bc919ea44ab3b0a
6 changes: 5 additions & 1 deletion block-editor/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ button:disabled .fa-icon-modifier-control {
height: 200px;
}

.fa-icon-modifier-preview span {
.fa-icon-modifier-preview div {
display: flex;
margin: auto;
transform: scale(10);
Expand Down Expand Up @@ -81,3 +81,7 @@ button:disabled .fa-icon-modifier-control {
stroke-width: 5px;
stroke-dasharray: 5, 5;
}

.wp-block-font-awesome-icon {
display: inline-block;
}
5 changes: 4 additions & 1 deletion block-editor/src/inlineSvgFormatType.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { faBrandIcon } from './icons';
import { GLOBAL_KEY } from "../../admin/src/constants";
import { normalizeIconDefinition } from './iconDefinitions'
import createCustomEvent from './createCustomEvent'

export const INLINE_SVG_FORMAT_WRAPPER_TAG_NAME = 'span'

const { IconChooserModal } = get(window, [
GLOBAL_KEY,
"iconChooser",
Expand Down Expand Up @@ -178,7 +181,7 @@ const mainSettings = {
name,
title,
keywords: [__("icon"), __("awesome")],
tagName: "span",
tagName: INLINE_SVG_FORMAT_WRAPPER_TAG_NAME,
className: "fa-icon-format",
edit: Edit,
};
Expand Down
4 changes: 2 additions & 2 deletions block-editor/src/rendering.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function renderIcon(attributes, extraProps = {}) {
const {wrapperProps, classNamesByLayer} = extraProps

return (
<span {...(wrapperProps || {})}>
<div {...(wrapperProps || {})}>
{attributes.iconLayers.map((layer, index) => {
const { iconDefinition, rotation: initialRotation, ...rest } = layer;
let className = (classNamesByLayer || [])[index]
Expand All @@ -46,6 +46,6 @@ export function renderIcon(attributes, extraProps = {}) {
/>
);
})}
</span>
</div>
);
}
8 changes: 6 additions & 2 deletions static/svgMutationObserver.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const REBUILD_SVG_VISITED_ATTR = "data-repaint-visited";
const ICON_FORMAT_CLASS = 'fa-icon-format';
const INLINE_SVG_FORMAT_WRAPPER_TAG_NAME = 'SPAN'

function maybeRebuildElement(el) {
if (!el.getAttribute(REBUILD_SVG_VISITED_ATTR)) {
Expand All @@ -21,8 +22,11 @@ function setupObserver() {
for (const child of mutation.addedNodes) {
if (
child.tagName &&
("SVG" == child.tagName.toUpperCase() &&
child.parentElement.classList.contains(ICON_FORMAT_CLASS))
(
(INLINE_SVG_FORMAT_WRAPPER_TAG_NAME.toUpperCase() === child.tagName.toUpperCase() && child.classList.contains(ICON_FORMAT_CLASS))
||
("SVG" == child.tagName.toUpperCase() && child.parentElement.classList.contains(ICON_FORMAT_CLASS))
)
) {
maybeRebuildElement(child);
}
Expand Down