add note with @Icon() reverse regex
useful when copy pasting Zammad html for a layout-reference to covert <svg>'s back to @Icons
This commit is contained in:
parent
1c6a32c8ce
commit
bd364bcb93
1 changed files with 7 additions and 0 deletions
|
@ -594,6 +594,13 @@ class App.Utils
|
||||||
num
|
num
|
||||||
|
|
||||||
@icon: (name, className = '') ->
|
@icon: (name, className = '') ->
|
||||||
|
#
|
||||||
|
# reverse regex
|
||||||
|
# =============
|
||||||
|
#
|
||||||
|
# search: <svg class="icon icon-([^\s]+)\s([^"]*).*<\/svg>
|
||||||
|
# replace: <%- @Icon('$1', '$2') %>
|
||||||
|
#
|
||||||
path = if window.svgPolyfill then '' else 'assets/images/icons.svg'
|
path = if window.svgPolyfill then '' else 'assets/images/icons.svg'
|
||||||
"<svg class=\"icon icon-#{name} #{className}\"><use xlink:href=\"#{path}#icon-#{name}\" /></svg>"
|
"<svg class=\"icon icon-#{name} #{className}\"><use xlink:href=\"#{path}#icon-#{name}\" /></svg>"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue