Plugin Directory

Changeset 3184822


Ignore:
Timestamp:
11/09/2024 11:05:30 AM (13 months ago)
Author:
Webaxones
Message:

Update to version 1.8.2 from GitHub

Location:
consistency
Files:
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • consistency/tags/1.8.2/build/index.asset.php

    r3145550 r3184822  
    1 <?php return array('dependencies' => array('react', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-rich-text'), 'version' => 'ab0245b936622e6790c8');
     1<?php return array('dependencies' => array('react', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-rich-text'), 'version' => '71c2764f0435ef4fe22c');
  • consistency/tags/1.8.2/build/index.js

    r3145550 r3184822  
    1 (()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var n in s)e.o(s,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:s[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,s=window.wp.plugins,n=window.wp.domReady;var o=e.n(n);const c=window.wp.element,r=(0,c.createContext)(),a=({children:e})=>{const[s]=(0,c.useState)(null!==document.querySelector('iframe[name="editor-canvas"]')),[n,o]=(0,c.useState)(!1),[a,i]=(0,c.useState)(""),[l,u]=(0,c.useState)([]),p=(0,c.useRef)(0),d=(0,c.useRef)(!1);return(0,t.createElement)(r.Provider,{value:{isEditorInIframe:s,isPreviousFixCanceled:n,setPreviousFixCanceled:o,previousFixCanceledContent:a,setPreviousFixCanceledContent:i,blocksToBeProcessed:l,setBlocksToBeProcessed:u,cursorOffsetRef:p,isContentPastedRef:d}},e)},i=r,l=window.wp.i18n,u=window.wp.editor,p=window.wp.data,d=window.wp.components,g=()=>(0,t.createElement)(d.Icon,{icon:(0,t.createElement)("svg",{version:"1.1",id:"consistency-plugin",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24",enableBackground:"new 0 0 24 24"},(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"4",y1:"20",x2:"7",y2:"20"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"14",y1:"20",x2:"21",y2:"20"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,t.createElement)("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:"5,20 11,4 13,4 20,20 "}))}),y=window.wp.coreData,m=window.wp.notices,h=e=>{const{settingSlug:s,settingName:n,settingDescription:o}=e,{currentUser:c}=(0,p.useSelect)((e=>({currentUser:e(y.store).getCurrentUser()})),[]),r=c&&c.id,[a,i]=(0,y.useEntityProp)("root","user","meta",r),{saveEditedEntityRecord:u}=(0,p.useDispatch)(y.store),{createNotice:g}=(0,p.useDispatch)(m.store);return(0,t.createElement)(d.ToggleControl,{label:n,help:(0,t.createElement)("span",{dangerouslySetInnerHTML:o}),checked:a?.consistency_plugin_user_settings?.find((e=>e.slug===s))?.value||!1,onChange:e=>{let t=a?.consistency_plugin_user_settings.map((t=>s===t.slug?{...t,value:e}:t));t?.find((e=>e.slug===s))||t.push({slug:s,value:e}),i({...a,consistency_plugin_user_settings:t}),u("root","user",r,{...a,meta:t}),g((0,l.__)("info","consistency"),e?sprintf((0,l.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,l.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}})},b=()=>(0,t.createElement)(d.Panel,{className:"UserSettingPanel"},(0,t.createElement)(d.PanelHeader,null,(0,t.createElement)("strong",null,(0,l.__)("Settings for my account","consistency")),(0,t.createElement)("br",null)),(0,t.createElement)("div",{style:{padding:16}},(0,t.createElement)(d.PanelRow,null,(0,t.createElement)(h,{settingSlug:"on_the_fly",settingName:(0,l.__)("On-the-fly autocorrect","consistency"),settingDescription:{__html:(0,l.__)("Enable/disable on-the-fly autocorrect","consistency")}})),(0,t.createElement)(d.PanelRow,null,(0,t.createElement)(h,{settingSlug:"on_paste",settingName:(0,l.__)("On paste autocorrect","consistency"),settingDescription:{__html:(0,l.__)("Enable/disable autocorrect on paste","consistency")}})))),f=window.wp.richText,_=e=>"string"==typeof e||e instanceof String,k=e=>"object"==typeof e&&e instanceof f.RichTextData,{getEntityRecord:w}=(0,p.select)("core"),{updateBlock:v}=(0,p.dispatch)("core/block-editor"),S=()=>{const e=w("root","site");return e?.consistency_plugin_localization_management||!0},x=()=>{const e=w("root","site");return e?.language||"en_US"},C=()=>{const e=x(),s=S()?(0,l.__)(` (${e} locale)`,"consistency"):(0,l.__)(" (all locales)","consistency");return(0,t.createElement)("span",{style:{fontWeight:"normal",fontStyle:"italic",fontSize:"smaller"}},s)},T=["regularToCurlyQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces","regularToGermanQuotes","regularToGermanBookStyleQuotes"],E=[{slug:"quote",incompatibleWith:[]},{slug:"2hyphens",incompatibleWith:[]},{slug:"3hyphens",incompatibleWith:[]},{slug:"4hyphens",incompatibleWith:[]},{slug:"ordinalNumberSuffix",incompatibleWith:[]},{slug:"regularToCurlyQuotes",incompatibleWith:["regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToGermanQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToGermanBookStyleQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToFrenchQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToFrenchQuotesWithoutSpaces",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes"]},{slug:"curlyToFrenchQuotes",incompatibleWith:["regularToCurlyQuotes"]},{slug:"breakingSpace",incompatibleWith:["spaceBefore"]},{slug:"noSpaceBefore",incompatibleWith:["spaceBefore"]},{slug:"spaceBefore",incompatibleWith:["breakingSpace","noSpaceBefore"]},{slug:"noBreakingSpaceAfter",incompatibleWith:[]},{slug:"noNonBreakingSpaceAfter",incompatibleWith:[]},{slug:"capitalizeFirstSentenceLetter",incompatibleWith:[]},{slug:"etcThreeDots",incompatibleWith:[]},{slug:"etcTwoDots",incompatibleWith:[]},{slug:"etcEllipsis",incompatibleWith:[]},{slug:"ellipsis",incompatibleWith:[]},{slug:"symbolInACircle",incompatibleWith:[]},{slug:"symbolInSmallCapsAndSuperscriptStyle",incompatibleWith:[]},{slug:"fractions",incompatibleWith:[]},{slug:"percentages",incompatibleWith:[]}],B=[{slug:"quote",name:(0,l.__)("Straight Apostrophe","consistency"),description:(0,l.__)("Replace straight apostrophes with curly apostrophes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>'</code> <span style='font-size:20px'>→</span> <code>’</code></span>",mask:/\'/,replace:"’",nbMoved:0,category:"apostrophe"},{slug:"2hyphens",name:(0,l.__)("En Dash","consistency"),description:(0,l.__)("Replace two hyphens with an en dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>--</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">–</code></span>",mask:/(?:\-)\-/,replace:"–",nbMoved:-1,category:"dash"},{slug:"3hyphens",name:(0,l.__)("Em Dash","consistency"),description:(0,l.__)("Replace three hyphens with an em dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>---</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">—</code></span>",mask:/(?:–|\-\-)\-/,replace:"—",nbMoved:e=>-(e.length-1),category:"dash"},{slug:"4hyphens",name:(0,l.__)("Two-Em Dash","consistency"),description:(0,l.__)("Replace four hyphens with two-em dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>----</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">⸺</code></span>",mask:/(?:—|–\-|\-\-\-)\-/,replace:"⸺",nbMoved:e=>-(e.length-1),category:"dash"},{slug:"ordinalNumberSuffix",name:(0,l.__)("Ordinal Number Suffix","consistency"),description:(0,l.__)("Add the sup HTML tag to ordinal number suffixes","consistency")+"<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>",mask:/([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/,replace:"$1<sup>$2</sup>$3",nbMoved:0,category:"suffixe"},{slug:"regularToCurlyQuotes",name:(0,l.__)("Curly Quotes","consistency"),description:(0,l.__)("Replace straight quotes with curly quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>“ ”</code></span>",mask:/"/,replace:"“$1”",nbMoved:0,category:"quotation"},{slug:"regularToGermanQuotes",name:(0,l.__)("German Quotes","consistency"),description:(0,l.__)("Replace straight quotes with german quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>„ “</code></span>",mask:/"/,replace:"„$1“",nbMoved:0,category:"quotation"},{slug:"regularToGermanBookStyleQuotes",name:(0,l.__)("German Book-Style Quotes","consistency"),description:(0,l.__)("Replace straight quotes with german book-style quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>» «</code></span>",mask:/"/,replace:"»$1«",nbMoved:0,category:"quotation"},{slug:"regularToFrenchQuotes",name:(0,l.__)("French Quotes with Spaces","consistency"),description:(0,l.__)("Replace straight quotes with french quotes with non-breaking spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>",mask:/"/,replace:"« $1 »",nbMoved:1,category:"quotation"},{slug:"regularToFrenchQuotesWithoutSpaces",name:(0,l.__)("French Quotes","consistency"),description:(0,l.__)("Replace straight quotes with french quotes without spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>« »</code></span>",mask:/"/,replace:"«$1»",nbMoved:0,category:"quotation"},{slug:"curlyToFrenchQuotes",name:(0,l.__)("Curly Quotes to French Quotes","consistency"),description:(0,l.__)("Replace curly quotes with french quotes with non-breaking spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>“ ”</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>",mask:/“.*?”/,replace:e=>`« ${e.substring(1,e.length-1)} »`,nbMoved:0,category:"quotation"},{slug:"breakingSpace",name:(0,l.__)("Breaking Spaces","consistency"),description:sprintf((0,l.__)("Replace a breaking space followed by a character from this list:%1$s with a non-breaking space","consistency"),"<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />"),mask:/ ([\?|\!|\:|\;|»|€|\$|£|¥|₽|元|\%])/,replace:" $1",nbMoved:0,category:"space"},{slug:"noSpaceBefore",name:(0,l.__)("No Space Before","consistency"),description:sprintf((0,l.__)("Add a non-breaking space before a character from this list:%1$s having no space before","consistency"),"<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />"),mask:/(?<! | |&nbsp;)([\?|\!|\:|»|€|\$|£|¥|₽|元|\%])/,replace:" $1",nbMoved:1,category:"space"},{slug:"spaceBefore",name:(0,l.__)("Space Before","consistency"),description:(0,l.__)("Remove any space preceding a character from this list:","consistency")+"<span style='display:block;'><code>? ! : ; %</code></span>",mask:/([ | ])(?=[\?|\!|\:|\;|\%])(.)/,replace:"$2",nbMoved:-1,category:"space"},{slug:"noBreakingSpaceAfter",name:(0,l.__)("No Breaking Space After","consistency"),description:sprintf((0,l.__)("Add a breaking space after a character from this list:%1$s when followed with another character","consistency"),"<br /><code>, … ) ]</code><br />"),mask:/([\,|…|\)|\]])(?! | |\.|\,|\d|$)(.)/,replace:"$1 $2",nbMoved:1,category:"space"},{slug:"noNonBreakingSpaceAfter",name:(0,l.__)("No Non-Breaking Space After","consistency"),description:(0,l.__)("Add a non-breaking space after open french quote having no space after","consistency"),mask:/(«)(?! | |&nbsp;)/,replace:"$1 ",nbMoved:0,category:"space"},{slug:"capitalizeFirstSentenceLetter",name:(0,l.__)("First Sentence Letter","consistency"),description:(0,l.__)("Capitalize the first letter of a sentence","consistency"),mask:/(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/,replace:e=>e.toUpperCase(),nbMoved:0,category:"case"},{slug:"etcThreeDots",name:(0,l.__)('Three Dots Following "etc"',"consistency"),description:(0,l.__)('Replace 3 dots placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc...</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{3})/i,replace:e=>e.substring(0,3)+".",nbMoved:-2,category:"ellipsis"},{slug:"etcTwoDots",name:(0,l.__)('Two Dots Following "etc"',"consistency"),description:(0,l.__)('Replace 2 dots placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc..</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{2})/i,replace:e=>e.substring(0,2)+".",nbMoved:-1,category:"ellipsis"},{slug:"etcEllipsis",name:(0,l.__)('Ellipsis Following "etc"',"consistency"),description:(0,l.__)('Replace the ellipsis placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc…</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{3}|…)/i,replace:e=>e.substring(0,3)+".",nbMoved:0,category:"ellipsis"},{slug:"ellipsis",name:(0,l.__)("Ellipsis","consistency"),description:(0,l.__)("Replaces 3 dots with ellipsis:","consistency")+"<span aria-hidden='true' style='display:block;'><code>...</code> <span style='font-size:20px'>→</span> <code>…</code></span>",mask:/\.{3}/,replace:"…",nbMoved:-2,category:"ellipsis"},{slug:"symbolInACircle",name:(0,l.__)("Symbol in a Circle","consistency"),description:(0,l.__)("Replaces 1 character placed in parentheses with a symbol","consistency")+"<span aria-hidden='true' style='display:block;'><code>(c) (p) (r)</code> <span style='font-size:20px'>→</span> <code>© ℗ ®</code></span>",mask:/(\([c|p|r])(\))/,replace:e=>{switch(e[1]){case"c":return"©";case"p":return"℗";case"r":return"®"}return" "},nbMoved:-2,category:"symbol"},{slug:"symbolInSmallCapsAndSuperscriptStyle",name:(0,l.__)("Symbol in Small Caps and Superscript Style","consistency"),description:(0,l.__)("Replaces 2-character abbreviations with a symbol in small caps and superscript style","consistency")+"<span aria-hidden='true' style='display:block;'><code>tm sm md mc</code> <span style='font-size:20px'>→</span> <code>™ ℠ 🅫 🅪</code></span>",mask:/(?<= | |\(|\[|\{|:|^)(tm|sm|md|mc)(?= | |\.|\,|\;|\:|\)|\]|\}|$)/,replace:e=>{switch(e){case"tm":return"™";case"sm":return"℠";case"md":return"🅫";case"mc":return"🅪";default:return" "}},nbMoved:-1,category:"symbol"},{slug:"fractions",name:(0,l.__)("Fractions","consistency"),description:(0,l.__)("Replaces fractions with fraction symbols:","consistency")+"<span aria-hidden='true' style='display:block;'><code>1/2 3/5 1/9</code> <span style='font-size:20px'>→</span> <code>½ ⅗ ⅑</code></span>",mask:/[1-9]\/[1-9]/,replace:e=>{switch(e){case"1/4":return"¼";case"1/2":return"½";case"3/4":return"¾";case"1/3":return"⅓";case"2/3":return"⅔";case"1/5":return"⅕";case"2/5":return"⅖";case"3/5":return"⅗";case"4/5":return"⅘";case"1/6":return"⅙";case"5/6":return"⅚";case"1/8":return"⅛";case"3/8":return"⅜";case"5/8":return"⅝";case"7/8":return"⅞";case"1/7":return"⅐";case"1/9":return"⅑";default:return" "}},nbMoved:-2,category:"symbol"},{slug:"percentages",name:(0,l.__)("Percentages","consistency"),description:(0,l.__)("Replaces percentages with percentages symbols:","consistency")+"<span aria-hidden='true' style='display:block;'><code>0/0 0/00 0/000</code> <span style='font-size:20px'>→</span> <code>% ‰ ‱</code></span>",mask:/(0\/0|0\/00|0\/000)(?= | |\.|\,|\;|\:|\)|\]|\})(.)/,replace:e=>{const t=e.substring(0,e.length-1),s=e.substring(e.length-1,e.length);switch(t){case"0/0":return"%"+s;case"0/00":return"‰"+s;case"0/000":return"‱"+s;default:return" "+s}},nbMoved:e=>-(e.substring(0,e.length-1).length-1),category:"symbol"}],{getBlock:F,getBlocks:P,getBlockAttributes:R,getSelectionStart:Q,isTyping:W}=(0,p.select)("core/block-editor"),{selectionChange:M,updateBlockAttributes:$}=(0,p.dispatch)("core/block-editor"),A=()=>{const e=(()=>{const e=w("root","site");return e?.consistency_plugin_settings||[]})();return S()?e.filter((e=>O(e.slug))):e},N=()=>B.filter((e=>!0===A()?.find((t=>t.slug===e.slug))?.value)),{getBlockName:q,getBlockAttributes:z}=(0,p.select)("core/block-editor"),O=e=>{const t=x();return!(void 0===localesByRules||!localesByRules.hasOwnProperty(e))&&localesByRules[e].includes(t)},I=e=>{const t=E.find((t=>t.slug===e));return!!t&&t.incompatibleWith.some((e=>A()?.find((t=>t.slug===e))?.value))},D=e=>{const{settingSlug:s,settingName:n,settingDescription:o}=e,{createNotice:c}=(0,p.useDispatch)(m.store);if(S()&&!O(s))return"";const[r,a]=(0,y.useEntityProp)("root","site","consistency_plugin_settings",void 0),{saveEditedEntityRecord:i}=(0,p.useDispatch)(y.store);return(0,t.createElement)(d.PanelRow,null,(0,t.createElement)(d.ToggleControl,{label:n,help:(0,t.createElement)("span",{dangerouslySetInnerHTML:o}),checked:r?.find((e=>e.slug===s))?.value||!1,disabled:I(s),onChange:e=>{let t=r.map((t=>s===t.slug?{...t,value:e}:t));a(t),i("root","site",void 0,t),c((0,l.__)("info","consistency"),e?sprintf((0,l.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,l.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}}))},L=[{slug:"apostrophe",label:(0,l.__)("Apostrophes","consistency"),description:(0,l.__)("Fixes related to apostrophes.","consistency")},{slug:"quotation",label:(0,l.__)("Quotation marks","consistency"),description:(0,l.__)("Fixes related to quotation marks.","consistency")},{slug:"dash",label:(0,l.__)("Dashes","consistency"),description:(0,l.__)("Fixes related to dashes.","consistency")},{slug:"suffixe",label:(0,l.__)("Suffixes","consistency"),description:(0,l.__)("Fixes related to suffixes.","consistency")},{slug:"space",label:(0,l.__)("Spaces","consistency"),description:(0,l.__)("Fixes related to spaces.","consistency")},{slug:"case",label:(0,l.__)("Case","consistency"),description:(0,l.__)("Fixes related to case.","consistency")},{slug:"ellipsis",label:(0,l.__)("Ellipsis","consistency"),description:(0,l.__)("Fixes related to ellipsis.","consistency")},{slug:"symbol",label:(0,l.__)("Symbols","consistency"),description:(0,l.__)("Fixes related to symbols.","consistency")}],G=()=>(0,t.createElement)(d.Panel,{className:"GlobalSettingPanel"},(0,t.createElement)(d.PanelHeader,null,(0,t.createElement)("strong",null,(0,l.__)("Global correction rules","consistency"),(0,t.createElement)(C,null))),[...L].map(((e,s)=>(0,t.createElement)(d.PanelBody,{key:s,title:(0,l.__)(e.label,"consistency"),initialOpen:!1},[...B].filter((t=>t.category===e.slug)).map(((e,s)=>(0,t.createElement)(D,{key:s,settingSlug:e.slug,settingName:e.name,settingDescription:{__html:e.description}}))))))),{canUser:j}=(0,p.select)("core"),U=()=>{const e=j("create","users");return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(u.PluginSidebar,{name:"consistency-custom-sidebar",title:(0,l.__)("Consistency","consistency"),icon:g},(0,t.createElement)(b,null),e&&(0,t.createElement)(G,null)),(0,t.createElement)(u.PluginSidebarMoreMenuItem,{target:"consistency-custom-sidebar"},(0,l.__)("Consistency Settings","consistency")))},{getBlock:H,getBlocks:K,getBlockAttributes:J,getSelectionStart:V,isTyping:X}=(0,p.select)("core/block-editor"),{updateBlockAttributes:Y}=(0,p.dispatch)("core/block-editor"),Z=e=>{const{currentBlockId:t,isPreviousFixCanceled:s,setPreviousFixCanceled:n,blocksToBeProcessed:o,cursorOffsetRef:c}=e;if(!(e=>{const{currentBlockId:t,blocksToBeProcessed:s}=e,n=q(t);return!!s.includes(n)})({currentBlockId:t,blocksToBeProcessed:o})||!(e=>{const t=z(e);return!(!t||!t.hasOwnProperty("content")||!_(t.content)&&!k(t.content))})(t))return;let r=N();const a=H(t);let i=J(t),l=!1;Object.entries(r).forEach((([e,o])=>{if(l)return;let r,u=o.replace,p="",d="",g=0,y=0,m="object"==typeof i.content?i.content.text:i.content,h=(e=>e.replace(/<\b(code|pre|kbd)\b>.*?<\/\b(code|pre|kbd)\b>/gi,"").replace(/(<([^>]+)>)/gi,""))(m),b=!1;if(X()||(b=o.mask.test(h)),X()){r=V(),g=r?.offset||document.getSelection()?.anchorOffset||0,y=(e=>{const t=document.querySelector(`#block-${e}`);if(null===t)return;const s=t.querySelector('[contenteditable="true"]')||t,n=document.getSelection(),o=n?.getRangeAt(0);if(!o||!o.collapsed)return;const c=o.cloneRange(),r=document.createTextNode("\0");c.insertNode(r);const a=s.textContent||"";let i=a.indexOf("\0");r.parentNode.removeChild(r),s.normalize();const l=(s?.innerHTML.match(/&nbsp;/g)||[]).length;return l>0&&(i=a.replace(/&nbsp;/g," ").indexOf("\0"),i=i-6*l+l),i})(t)||g;const e=h.match(o.mask);if(null===e||0===e.length)return;const s=e[0].length||1;p=h.substring(0,y-s),d=h.substring(y-s,h.length),b=o.mask.test(h)&&o.mask.test(d)}if(!b)return;if((e=>!!T.includes(e.slug))(o)&&(u=((e,t,s)=>{const n=e.replace.charAt(0),o=e.replace.charAt(e.replace.length-1),c=e.replace.substring(1,e.replace.indexOf("$"))||"";let r="";0!==[...e.replace.matchAll(/[0-9]/g)].length&&(r=e.replace.substring([...e.replace.matchAll(/[0-9]/g)].pop().index+1,e.replace.length-1));const a=new RegExp(`${n}`,"g"),i=new RegExp(`${o}`,"g");return(t.match(a)||[]).length===(t.match(i)||[]).length?n+c:r+o})(o,m)),0!==y&&(m=p+d.replace(o.mask,u)),0===y&&(m=m.replace(o.mask,o.replace)),s)return void n(!1);s||(l=(e=>{const{block:t,currentBlockId:s,blockAttributes:n,blockContent:o}=e;let c;if(k(n.content)){const e=(0,f.create)({...n.content,text:o});c=new f.RichTextData(e)}return _(n.content)&&(c=o),void 0!==c&&(v(s,{...t,attributes:{...n,content:c}}),!0)})({block:a,currentBlockId:t,blockAttributes:i,blockContent:m}));const w="function"==typeof o.nbMoved?o.nbMoved(d):o.nbMoved||0;l&&(c.current=w)}))},{getSelectedBlockClientId:ee,isTyping:te,getBlockAttributes:se}=(0,p.select)("core/block-editor"),ne=window.wp.blocks,oe=()=>((()=>{const{isEditorInIframe:e,isContentPastedRef:t}=(0,c.useContext)(i),s=(0,c.useRef)(!1);(0,c.useEffect)((()=>{if(s.current)return;const n=e=>{t.current=!0},o=e=>(e.addEventListener("paste",n),()=>{e.removeEventListener("paste",n)}),c=e?document.querySelector('iframe[name="editor-canvas"]'):document.querySelector("#editor");if(!c)return;const r=o(c);return e&&"complete"===c.contentWindow.document.readyState&&o(c),s.current=!0,r}),[e])})(),(()=>{const{isEditorInIframe:e,setPreviousFixCanceled:t}=(0,c.useContext)(i),s=(0,c.useRef)(!1);(0,c.useEffect)((()=>{if(s.current)return;const n=e=>{90===e.keyCode&&(e.ctrlKey||e.metaKey)&&t(!0)},o=e=>(e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}),c=e?document.querySelector('iframe[name="editor-canvas"]'):document.querySelector("#editor");if(!c)return;const r=o(c);return e&&"complete"===c.contentWindow.document.readyState&&o(c),s.current=!0,r}),[t])})(),(()=>{const{setBlocksToBeProcessed:e}=(0,c.useContext)(i);(0,c.useEffect)((()=>{let t=(0,ne.getBlockTypes)().filter((e=>e.attributes&&e.attributes.content&&("string"===e.attributes.content.type||"rich-text"===e.attributes.content.type)));const s=["core/html"];t=t.filter((e=>!s.includes(e.name))),console.log("Consistency - Blocks that can be processed:",t),e(t.map((e=>e.name)))}),[])})(),(()=>{const{isPreviousFixCanceled:e,setPreviousFixCanceled:t,previousFixCanceledContent:s,setPreviousFixCanceledContent:n,blocksToBeProcessed:o,cursorOffsetRef:r,isContentPastedRef:a}=(0,c.useContext)(i);r.current=r.current||0,a.current=a.current||!1,(0,c.useEffect)((()=>{const c=(0,p.subscribe)((()=>{const{onTheFly:c,onPaste:i}=(()=>{const e={onTheFly:!1,onPaste:!1},t=(0,p.select)(y.store).getCurrentUser(),s=w("root","user",t?.id||0,"consistency_plugin_user_settings"),n=s?.meta?.consistency_plugin_user_settings;return e.onTheFly=n?.find((e=>"on_the_fly"===e.slug))?.value||!1,e.onPaste=n?.find((e=>"on_paste"===e.slug))?.value||!1,e})();if(!c&&!i)return;if(void 0===A())return;if(i&&!0===a.current)return a.current=!1,void(e=>{const{isPreviousFixCanceled:t,setPreviousFixCanceled:s,blocksToBeProcessed:n,cursorOffsetRef:o}=e;let c=N();const r=K(),a=r.flatMap((({innerBlocks:e,...t})=>e.map((e=>({...t,...e}))))),i=r.reduce(((e,t)=>{let s=t.attributes?.content;return n.includes(t.name)&&void 0!==s?(Object.entries(c).forEach((([e,t])=>{if(T.includes(t.slug)){const e=t.mask.toString().match(/(?<=\/).+?(?=\/)/g)[0],n=new RegExp(`(?<!=)${e}(?!>)([^${e}]*)(?<!=)${e}(?!>)`,"g");s=s.replaceAll(n,t.replace)}if(!T.includes(t.slug)){const e=t.mask.toString(),n=new RegExp(e.substring(1,e.length-1),"g");s=s.replaceAll(n,t.replace)}})),void 0!==s&&(e[t.clientId]={content:s}),e):e}),{});Object.keys(i).length>0&&Y(Object.keys(i),i,!0),a.forEach((e=>{if(!n.includes(e.name))return;const c=e.clientId;e?.clientId&&Z({currentBlockId:c,isPreviousFixCanceled:t,setPreviousFixCanceled:s,blocksToBeProcessed:n,cursorOffsetRef:o})}))})({isPreviousFixCanceled:e,setPreviousFixCanceled:t,blocksToBeProcessed:o,cursorOffsetRef:r});const l=ee();if(null===l||!c)return;const u=se(l);u&&(u.hasOwnProperty("content")&&s===u.content||(n(u.content),te()&&Z({currentBlockId:l,isPreviousFixCanceled:e,setPreviousFixCanceled:t,blocksToBeProcessed:o,cursorOffsetRef:r})))}));return()=>{c(),(e=>{const t=window.getSelection();if(!t)return;let s;1===t?.anchorNode?.nodeType&&(s=t.anchorNode?.firstChild?.length||0),3===t?.anchorNode?.nodeType&&(s=t.anchorOffset||0);const n=e>=0?s+e:s;if(1!==t?.anchorNode?.nodeType)if(3!==t?.anchorNode?.nodeType);else{const e=t.anchorNode;t.collapse(e,n)}else{const e=t.anchorNode?.firstChild||t.anchorNode?.childNodes[0];t.collapse(e,n)}})(r.current),r.current=0}}),[e,t,s,n,o,r,a])})(),(0,t.createElement)(U,null)),ce=()=>(0,t.createElement)(a,null,(0,t.createElement)(oe,null));o()((()=>{(0,s.registerPlugin)("consistency-custom-sidebar",{render:ce})}))})();
     1(()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var n in s)e.o(s,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:s[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,s=window.wp.plugins,n=window.wp.domReady;var o=e.n(n);const c=window.wp.element,r=(0,c.createContext)(),a=({children:e})=>{const[s]=(0,c.useState)(null!==document.querySelector('iframe[name="editor-canvas"]')),[n,o]=(0,c.useState)(!1),[a,i]=(0,c.useState)(""),[l,u]=(0,c.useState)([]),d=(0,c.useRef)(0),p=(0,c.useRef)(!1);return(0,t.createElement)(r.Provider,{value:{isEditorInIframe:s,isPreviousFixCanceled:n,setPreviousFixCanceled:o,previousFixCanceledContent:a,setPreviousFixCanceledContent:i,blocksToBeProcessed:l,setBlocksToBeProcessed:u,cursorOffsetRef:d,isContentPastedRef:p}},e)},i=r,l=window.wp.i18n,u=window.wp.editor,d=window.wp.data,p=window.wp.components,y=()=>(0,t.createElement)(p.Icon,{icon:(0,t.createElement)("svg",{version:"1.1",id:"consistency-plugin",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24",enableBackground:"new 0 0 24 24"},(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"4",y1:"20",x2:"7",y2:"20"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"14",y1:"20",x2:"21",y2:"20"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,t.createElement)("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:"5,20 11,4 13,4 20,20 "}))}),g=window.wp.coreData,m=window.wp.notices,h=e=>{const{settingSlug:s,settingName:n,settingDescription:o}=e,{currentUser:c}=(0,d.useSelect)((e=>({currentUser:e(g.store).getCurrentUser()})),[]),r=c&&c.id,[a,i]=(0,g.useEntityProp)("root","user","meta",r),{saveEditedEntityRecord:u}=(0,d.useDispatch)(g.store),{createNotice:y}=(0,d.useDispatch)(m.store);return(0,t.createElement)(p.ToggleControl,{label:n,help:(0,t.createElement)("span",{dangerouslySetInnerHTML:o}),checked:a?.consistency_plugin_user_settings?.find((e=>e.slug===s))?.value||!1,onChange:e=>{let t=a?.consistency_plugin_user_settings.map((t=>s===t.slug?{...t,value:e}:t));t?.find((e=>e.slug===s))||t.push({slug:s,value:e}),i({...a,consistency_plugin_user_settings:t}),u("root","user",r,{...a,meta:t}),y((0,l.__)("info","consistency"),e?sprintf((0,l.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,l.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}})},f=()=>(0,t.createElement)(p.Panel,{className:"UserSettingPanel"},(0,t.createElement)(p.PanelHeader,null,(0,t.createElement)("strong",null,(0,l.__)("Settings for my account","consistency")),(0,t.createElement)("br",null)),(0,t.createElement)("div",{style:{padding:16}},(0,t.createElement)(p.PanelRow,null,(0,t.createElement)(h,{settingSlug:"on_the_fly",settingName:(0,l.__)("On-the-fly autocorrect","consistency"),settingDescription:{__html:(0,l.__)("Enable/disable on-the-fly autocorrect","consistency")}})),(0,t.createElement)(p.PanelRow,null,(0,t.createElement)(h,{settingSlug:"on_paste",settingName:(0,l.__)("On paste autocorrect","consistency"),settingDescription:{__html:(0,l.__)("Enable/disable autocorrect on paste","consistency")}})))),b=window.wp.richText,_=e=>"string"==typeof e||e instanceof String,k=e=>"object"==typeof e&&e instanceof b.RichTextData,{getEntityRecord:w}=(0,d.select)("core"),{updateBlock:v}=(0,d.dispatch)("core/block-editor"),S=()=>{const e=w("root","site");return e?.consistency_plugin_localization_management||!0},x=()=>{const e=w("root","site");return e?.language||"en_US"},C=()=>{const e=x(),s=S()?(0,l.__)(` (${e} locale)`,"consistency"):(0,l.__)(" (all locales)","consistency");return(0,t.createElement)("span",{style:{fontWeight:"normal",fontStyle:"italic",fontSize:"smaller"}},s)},T=["regularToCurlyQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces","regularToGermanQuotes","regularToGermanBookStyleQuotes"],E=[{slug:"quote",incompatibleWith:[]},{slug:"2hyphens",incompatibleWith:[]},{slug:"3hyphens",incompatibleWith:[]},{slug:"4hyphens",incompatibleWith:[]},{slug:"ordinalNumberSuffix",incompatibleWith:[]},{slug:"regularToCurlyQuotes",incompatibleWith:["regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToGermanQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToGermanBookStyleQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToFrenchQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToFrenchQuotesWithoutSpaces",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes"]},{slug:"curlyToFrenchQuotes",incompatibleWith:["regularToCurlyQuotes"]},{slug:"breakingSpace",incompatibleWith:["spaceBefore"]},{slug:"noSpaceBefore",incompatibleWith:["spaceBefore"]},{slug:"spaceBefore",incompatibleWith:["breakingSpace","noSpaceBefore"]},{slug:"noBreakingSpaceAfter",incompatibleWith:[]},{slug:"noNonBreakingSpaceAfter",incompatibleWith:[]},{slug:"capitalizeFirstSentenceLetter",incompatibleWith:[]},{slug:"etcThreeDots",incompatibleWith:[]},{slug:"etcTwoDots",incompatibleWith:[]},{slug:"etcEllipsis",incompatibleWith:[]},{slug:"ellipsis",incompatibleWith:[]},{slug:"symbolInACircle",incompatibleWith:[]},{slug:"symbolInSmallCapsAndSuperscriptStyle",incompatibleWith:[]},{slug:"fractions",incompatibleWith:[]},{slug:"percentages",incompatibleWith:[]}],B=[{slug:"quote",name:(0,l.__)("Straight Apostrophe","consistency"),description:(0,l.__)("Replace straight apostrophes with curly apostrophes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>'</code> <span style='font-size:20px'>→</span> <code>’</code></span>",mask:/\'/,replace:"’",format:"",nbMoved:0,category:"apostrophe"},{slug:"2hyphens",name:(0,l.__)("En Dash","consistency"),description:(0,l.__)("Replace two hyphens with an en dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>--</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">–</code></span>",mask:/(?:\-)\-/,replace:"–",format:"",nbMoved:-1,category:"dash"},{slug:"3hyphens",name:(0,l.__)("Em Dash","consistency"),description:(0,l.__)("Replace three hyphens with an em dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>---</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">—</code></span>",mask:/(?:–|\-\-)\-/,replace:"—",format:"",nbMoved:e=>-(e.length-1),category:"dash"},{slug:"4hyphens",name:(0,l.__)("Two-Em Dash","consistency"),description:(0,l.__)("Replace four hyphens with two-em dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>----</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">⸺</code></span>",mask:/(?:—|–\-|\-\-\-)\-/,replace:"⸺",format:"",nbMoved:e=>-(e.length-1),category:"dash"},{slug:"ordinalNumberSuffix",name:(0,l.__)("Ordinal Number Suffix","consistency"),description:(0,l.__)("Add the sup HTML tag to ordinal number suffixes","consistency")+"<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>",mask:/([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/,replace:"$1$2$3",format:"superscript",nbMoved:0,category:"suffixe"},{slug:"regularToCurlyQuotes",name:(0,l.__)("Curly Quotes","consistency"),description:(0,l.__)("Replace straight quotes with curly quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>“ ”</code></span>",mask:/"/,replace:"“$1”",format:"",nbMoved:0,category:"quotation"},{slug:"regularToGermanQuotes",name:(0,l.__)("German Quotes","consistency"),description:(0,l.__)("Replace straight quotes with german quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>„ “</code></span>",mask:/"/,replace:"„$1“",format:"",nbMoved:0,category:"quotation"},{slug:"regularToGermanBookStyleQuotes",name:(0,l.__)("German Book-Style Quotes","consistency"),description:(0,l.__)("Replace straight quotes with german book-style quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>» «</code></span>",mask:/"/,replace:"»$1«",format:"",nbMoved:0,category:"quotation"},{slug:"regularToFrenchQuotes",name:(0,l.__)("French Quotes with Spaces","consistency"),description:(0,l.__)("Replace straight quotes with french quotes with non-breaking spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>",mask:/"/,replace:"« $1 »",format:"",nbMoved:1,category:"quotation"},{slug:"regularToFrenchQuotesWithoutSpaces",name:(0,l.__)("French Quotes","consistency"),description:(0,l.__)("Replace straight quotes with french quotes without spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>« »</code></span>",mask:/"/,replace:"«$1»",format:"",nbMoved:0,category:"quotation"},{slug:"curlyToFrenchQuotes",name:(0,l.__)("Curly Quotes to French Quotes","consistency"),description:(0,l.__)("Replace curly quotes with french quotes with non-breaking spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>“ ”</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>",mask:/“.*?”/,replace:e=>`« ${e.substring(1,e.length-1)} »`,format:"",nbMoved:0,category:"quotation"},{slug:"breakingSpace",name:(0,l.__)("Breaking Spaces","consistency"),description:sprintf((0,l.__)("Replace a breaking space followed by a character from this list:%1$s with a non-breaking space","consistency"),"<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />"),mask:/ ([\?|\!|\:|\;|»|€|\$|£|¥|₽|元|\%])/,replace:" $1",format:"",nbMoved:0,category:"space"},{slug:"noSpaceBefore",name:(0,l.__)("No Space Before","consistency"),description:sprintf((0,l.__)("Add a non-breaking space before a character from this list:%1$s having no space before","consistency"),"<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />"),mask:/(?<! | |&nbsp;)([\?|\!|\:|»|€|\$|£|¥|₽|元|\%])/,replace:" $1",format:"",nbMoved:1,category:"space"},{slug:"spaceBefore",name:(0,l.__)("Space Before","consistency"),description:(0,l.__)("Remove any space preceding a character from this list:","consistency")+"<span style='display:block;'><code>? ! : ; %</code></span>",mask:/([ | ])(?=[\?|\!|\:|\;|\%])(.)/,replace:"$2",format:"",nbMoved:-1,category:"space"},{slug:"noBreakingSpaceAfter",name:(0,l.__)("No Breaking Space After","consistency"),description:sprintf((0,l.__)("Add a breaking space after a character from this list:%1$s when followed with another character","consistency"),"<br /><code>, … ) ]</code><br />"),mask:/([\,|…|\)|\]])(?! | |\.|\,|\d|$)(.)/,replace:"$1 $2",format:"",nbMoved:1,category:"space"},{slug:"noNonBreakingSpaceAfter",name:(0,l.__)("No Non-Breaking Space After","consistency"),description:(0,l.__)("Add a non-breaking space after open french quote having no space after","consistency"),mask:/(«)(?! | |&nbsp;)/,replace:"$1 ",format:"",nbMoved:0,category:"space"},{slug:"capitalizeFirstSentenceLetter",name:(0,l.__)("First Sentence Letter","consistency"),description:(0,l.__)("Capitalize the first letter of a sentence","consistency"),mask:/(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/,replace:e=>e.toUpperCase(),format:"",nbMoved:0,category:"case"},{slug:"etcThreeDots",name:(0,l.__)('Three Dots Following "etc"',"consistency"),description:(0,l.__)('Replace 3 dots placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc...</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{3})/i,replace:e=>e.substring(0,3)+".",format:"",nbMoved:-2,category:"ellipsis"},{slug:"etcTwoDots",name:(0,l.__)('Two Dots Following "etc"',"consistency"),description:(0,l.__)('Replace 2 dots placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc..</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{2})/i,replace:e=>e.substring(0,2)+".",format:"",nbMoved:-1,category:"ellipsis"},{slug:"etcEllipsis",name:(0,l.__)('Ellipsis Following "etc"',"consistency"),description:(0,l.__)('Replace the ellipsis placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc…</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{3}|…)/i,replace:e=>e.substring(0,3)+".",format:"",nbMoved:0,category:"ellipsis"},{slug:"ellipsis",name:(0,l.__)("Ellipsis","consistency"),description:(0,l.__)("Replaces 3 dots with ellipsis:","consistency")+"<span aria-hidden='true' style='display:block;'><code>...</code> <span style='font-size:20px'>→</span> <code>…</code></span>",mask:/\.{3}/,replace:"…",format:"",nbMoved:-2,category:"ellipsis"},{slug:"symbolInACircle",name:(0,l.__)("Symbol in a Circle","consistency"),description:(0,l.__)("Replaces 1 character placed in parentheses with a symbol","consistency")+"<span aria-hidden='true' style='display:block;'><code>(c) (p) (r)</code> <span style='font-size:20px'>→</span> <code>© ℗ ®</code></span>",mask:/(\([c|p|r])(\))/,replace:e=>{switch(e[1]){case"c":return"©";case"p":return"℗";case"r":return"®"}return" "},format:"",nbMoved:-2,category:"symbol"},{slug:"symbolInSmallCapsAndSuperscriptStyle",name:(0,l.__)("Symbol in Small Caps and Superscript Style","consistency"),description:(0,l.__)("Replaces 2-character abbreviations with a symbol in small caps and superscript style","consistency")+"<span aria-hidden='true' style='display:block;'><code>tm sm md mc</code> <span style='font-size:20px'>→</span> <code>™ ℠ 🅫 🅪</code></span>",mask:/(?<= | |\(|\[|\{|:|^)(tm|sm|md|mc)(?= | |\.|\,|\;|\:|\)|\]|\}|$)/,replace:e=>{switch(e){case"tm":return"™";case"sm":return"℠";case"md":return"🅫";case"mc":return"🅪";default:return" "}},format:"",nbMoved:-1,category:"symbol"},{slug:"fractions",name:(0,l.__)("Fractions","consistency"),description:(0,l.__)("Replaces fractions with fraction symbols:","consistency")+"<span aria-hidden='true' style='display:block;'><code>1/2 3/5 1/9</code> <span style='font-size:20px'>→</span> <code>½ ⅗ ⅑</code></span>",mask:/[1-9]\/[1-9]/,replace:e=>{switch(e){case"1/4":return"¼";case"1/2":return"½";case"3/4":return"¾";case"1/3":return"⅓";case"2/3":return"⅔";case"1/5":return"⅕";case"2/5":return"⅖";case"3/5":return"⅗";case"4/5":return"⅘";case"1/6":return"⅙";case"5/6":return"⅚";case"1/8":return"⅛";case"3/8":return"⅜";case"5/8":return"⅝";case"7/8":return"⅞";case"1/7":return"⅐";case"1/9":return"⅑";default:return" "}},format:"",nbMoved:-2,category:"symbol"},{slug:"percentages",name:(0,l.__)("Percentages","consistency"),description:(0,l.__)("Replaces percentages with percentages symbols:","consistency")+"<span aria-hidden='true' style='display:block;'><code>0/0 0/00 0/000</code> <span style='font-size:20px'>→</span> <code>% ‰ ‱</code></span>",mask:/(0\/0|0\/00|0\/000)(?= | |\.|\,|\;|\:|\)|\]|\})(.)/,replace:e=>{const t=e.substring(0,e.length-1),s=e.substring(e.length-1,e.length);switch(t){case"0/0":return"%"+s;case"0/00":return"‰"+s;case"0/000":return"‱"+s;default:return" "+s}},format:"",nbMoved:e=>-(e.substring(0,e.length-1).length-1),category:"symbol"}],{getSelectionStart:F}=(0,d.select)("core/block-editor"),{selectionChange:P}=(0,d.dispatch)("core/block-editor"),R=()=>{const e=(()=>{const e=w("root","site");return e?.consistency_plugin_settings||[]})();return S()?e.filter((e=>$(e.slug))):e},Q=()=>B.filter((e=>!0===R()?.find((t=>t.slug===e.slug))?.value)),{getBlockName:W,getBlockAttributes:M}=(0,d.select)("core/block-editor"),$=e=>{const t=x();return!(void 0===localesByRules||!localesByRules.hasOwnProperty(e))&&localesByRules[e].includes(t)},N=e=>{const t=E.find((t=>t.slug===e));return!!t&&t.incompatibleWith.some((e=>R()?.find((t=>t.slug===e))?.value))},q=e=>{const{settingSlug:s,settingName:n,settingDescription:o}=e,{createNotice:c}=(0,d.useDispatch)(m.store);if(S()&&!$(s))return"";const[r,a]=(0,g.useEntityProp)("root","site","consistency_plugin_settings",void 0),{saveEditedEntityRecord:i}=(0,d.useDispatch)(g.store);return(0,t.createElement)(p.PanelRow,null,(0,t.createElement)(p.ToggleControl,{label:n,help:(0,t.createElement)("span",{dangerouslySetInnerHTML:o}),checked:r?.find((e=>e.slug===s))?.value||!1,disabled:N(s),onChange:e=>{let t=r.map((t=>s===t.slug?{...t,value:e}:t));a(t),i("root","site",void 0,t),c((0,l.__)("info","consistency"),e?sprintf((0,l.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,l.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}}))},A=[{slug:"apostrophe",label:(0,l.__)("Apostrophes","consistency"),description:(0,l.__)("Fixes related to apostrophes.","consistency")},{slug:"quotation",label:(0,l.__)("Quotation marks","consistency"),description:(0,l.__)("Fixes related to quotation marks.","consistency")},{slug:"dash",label:(0,l.__)("Dashes","consistency"),description:(0,l.__)("Fixes related to dashes.","consistency")},{slug:"suffixe",label:(0,l.__)("Suffixes","consistency"),description:(0,l.__)("Fixes related to suffixes.","consistency")},{slug:"space",label:(0,l.__)("Spaces","consistency"),description:(0,l.__)("Fixes related to spaces.","consistency")},{slug:"case",label:(0,l.__)("Case","consistency"),description:(0,l.__)("Fixes related to case.","consistency")},{slug:"ellipsis",label:(0,l.__)("Ellipsis","consistency"),description:(0,l.__)("Fixes related to ellipsis.","consistency")},{slug:"symbol",label:(0,l.__)("Symbols","consistency"),description:(0,l.__)("Fixes related to symbols.","consistency")}],z=()=>(0,t.createElement)(p.Panel,{className:"GlobalSettingPanel"},(0,t.createElement)(p.PanelHeader,null,(0,t.createElement)("strong",null,(0,l.__)("Global correction rules","consistency"),(0,t.createElement)(C,null))),[...A].map(((e,s)=>(0,t.createElement)(p.PanelBody,{key:s,title:(0,l.__)(e.label,"consistency"),initialOpen:!1},[...B].filter((t=>t.category===e.slug)).map(((e,s)=>(0,t.createElement)(q,{key:s,settingSlug:e.slug,settingName:e.name,settingDescription:{__html:e.description}}))))))),{canUser:I}=(0,d.select)("core"),O=()=>{const e=I("create","users");return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(u.PluginSidebar,{name:"consistency-custom-sidebar",title:(0,l.__)("Consistency","consistency"),icon:y},(0,t.createElement)(f,null),e&&(0,t.createElement)(z,null)),(0,t.createElement)(u.PluginSidebarMoreMenuItem,{target:"consistency-custom-sidebar"},(0,l.__)("Consistency Settings","consistency")))},{getBlock:D,getBlocks:L,getBlockAttributes:G,getSelectionStart:j,isTyping:U}=(0,d.select)("core/block-editor"),{updateBlockAttributes:H,updateBlock:K}=(0,d.dispatch)("core/block-editor"),J=e=>{const{currentBlockId:t,isPreviousFixCanceled:s,setPreviousFixCanceled:n,blocksToBeProcessed:o,cursorOffsetRef:c}=e;if(!(e=>{const{currentBlockId:t,blocksToBeProcessed:s}=e,n=W(t);return!!s.includes(n)})({currentBlockId:t,blocksToBeProcessed:o})||!(e=>{const t=M(e);return!(!t||!t.hasOwnProperty("content")||!_(t.content)&&!k(t.content))})(t))return;let r=Q();const a=D(t);let i=G(t),l=!1;Object.entries(r).forEach((([e,o])=>{if(l)return;if(""!==o.format)return;i.content;let r,u=o.replace,d="",p="",y=0,g=0,m=("object"==typeof i.content&&i.content,"object"==typeof i.content?i.content.text:i.content),h=(e=>e.replace(/<\b(code|pre|kbd)\b>.*?<\/\b(code|pre|kbd)\b>/gi,"").replace(/(<([^>]+)>)/gi,""))(m),f=!1;if(U()||(f=o.mask.test(h)),U()){r=j(),y=r?.offset||document.getSelection()?.anchorOffset||0,g=(e=>{const t=document.querySelector(`#block-${e}`);if(null===t)return;const s=t.querySelector('[contenteditable="true"]')||t,n=document.getSelection(),o=n?.getRangeAt(0);if(!o||!o.collapsed)return;const c=o.cloneRange(),r=document.createTextNode("\0");c.insertNode(r);const a=s.textContent||"";let i=a.indexOf("\0");r.parentNode.removeChild(r),s.normalize();const l=(s?.innerHTML.match(/&nbsp;/g)||[]).length;return l>0&&(i=a.replace(/&nbsp;/g," ").indexOf("\0"),i=i-6*l+l),i})(t)||y;const e=h.match(o.mask);if(null===e||0===e.length)return;const s=e[0].length||1;d=h.substring(0,g-s),p=h.substring(g-s,h.length),f=o.mask.test(h)&&o.mask.test(p)}if(!f)return;if((e=>!!T.includes(e.slug))(o)&&(u=((e,t,s)=>{const n=e.replace.charAt(0),o=e.replace.charAt(e.replace.length-1),c=e.replace.substring(1,e.replace.indexOf("$"))||"";let r="";0!==[...e.replace.matchAll(/[0-9]/g)].length&&(r=e.replace.substring([...e.replace.matchAll(/[0-9]/g)].pop().index+1,e.replace.length-1));const a=new RegExp(`${n}`,"g"),i=new RegExp(`${o}`,"g");return(t.match(a)||[]).length===(t.match(i)||[]).length?n+c:r+o})(o,m)),0!==g&&(m=d+p.replace(o.mask,u)),0===g&&(m=m.replace(o.mask,o.replace)),s)return void n(!1);s||""!==o.format||(l=(e=>{const{block:t,currentBlockId:s,blockAttributes:n,blockContent:o}=e;let c;if(k(n.content)){const e=(0,b.create)({...n.content,text:o});c=new b.RichTextData(e)}return _(n.content)&&(c=o),void 0!==c&&(v(s,{...t,attributes:{...n,content:c}}),!0)})({block:a,currentBlockId:t,blockAttributes:i,blockContent:m}));const w="function"==typeof o.nbMoved?o.nbMoved(p):o.nbMoved||0;l&&(c.current=w)}))},{getSelectedBlockClientId:V,isTyping:X,getBlockAttributes:Y}=(0,d.select)("core/block-editor"),Z=window.wp.blocks,ee=()=>((()=>{const{isEditorInIframe:e,isContentPastedRef:t}=(0,c.useContext)(i),s=(0,c.useRef)(!1);(0,c.useEffect)((()=>{if(s.current)return;const n=e=>{t.current=!0},o=e=>(e.addEventListener("paste",n),()=>{e.removeEventListener("paste",n)}),c=e?document.querySelector('iframe[name="editor-canvas"]'):document.querySelector("#editor");if(!c)return;const r=o(c);return e&&"complete"===c.contentWindow.document.readyState&&o(c),s.current=!0,r}),[e])})(),(()=>{const{isEditorInIframe:e,setPreviousFixCanceled:t}=(0,c.useContext)(i),s=(0,c.useRef)(!1);(0,c.useEffect)((()=>{if(s.current)return;const n=e=>{90===e.keyCode&&(e.ctrlKey||e.metaKey)&&t(!0)},o=e=>(e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}),c=e?document.querySelector('iframe[name="editor-canvas"]'):document.querySelector("#editor");if(!c)return;const r=o(c);return e&&"complete"===c.contentWindow.document.readyState&&o(c),s.current=!0,r}),[t])})(),(()=>{const{setBlocksToBeProcessed:e}=(0,c.useContext)(i);(0,c.useEffect)((()=>{let t=(0,Z.getBlockTypes)().filter((e=>e.attributes&&e.attributes.content&&("string"===e.attributes.content.type||"rich-text"===e.attributes.content.type)));const s=["core/html"];t=t.filter((e=>!s.includes(e.name))),console.log("Consistency - Blocks that can be processed:",t),e(t.map((e=>e.name)))}),[])})(),(()=>{const{isPreviousFixCanceled:e,setPreviousFixCanceled:t,previousFixCanceledContent:s,setPreviousFixCanceledContent:n,blocksToBeProcessed:o,cursorOffsetRef:r,isContentPastedRef:a}=(0,c.useContext)(i);r.current=r.current||0,a.current=a.current||!1,(0,c.useEffect)((()=>{const c=(0,d.subscribe)((()=>{const{onTheFly:c,onPaste:i}=(()=>{const e={onTheFly:!1,onPaste:!1},t=(0,d.select)(g.store).getCurrentUser(),s=w("root","user",t?.id||0,"consistency_plugin_user_settings"),n=s?.meta?.consistency_plugin_user_settings;return e.onTheFly=n?.find((e=>"on_the_fly"===e.slug))?.value||!1,e.onPaste=n?.find((e=>"on_paste"===e.slug))?.value||!1,e})();if(!c&&!i)return;if(void 0===R())return;if(i&&!0===a.current)return a.current=!1,void(e=>{const{isPreviousFixCanceled:t,setPreviousFixCanceled:s,blocksToBeProcessed:n,cursorOffsetRef:o}=e;let c=Q();const r=L(),a=r.flatMap((({innerBlocks:e,...t})=>e.map((e=>({...t,...e}))))),i=r.reduce(((e,t)=>{let s=t.attributes?.content;return n.includes(t.name)&&void 0!==s?(Object.entries(c).forEach((([e,t])=>{if(T.includes(t.slug)){const e=t.mask.toString().match(/(?<=\/).+?(?=\/)/g)[0],n=new RegExp(`(?<!=)${e}(?!>)([^${e}]*)(?<!=)${e}(?!>)`,"g");s=s.replaceAll(n,t.replace)}if(!T.includes(t.slug)){const e=t.mask.toString(),n=new RegExp(e.substring(1,e.length-1),"g");s=s.replaceAll(n,t.replace)}})),void 0!==s&&(e[t.clientId]={content:s}),e):e}),{});Object.keys(i).length>0&&H(Object.keys(i),i,!0),a.forEach((e=>{if(!n.includes(e.name))return;const c=e.clientId;e?.clientId&&J({currentBlockId:c,isPreviousFixCanceled:t,setPreviousFixCanceled:s,blocksToBeProcessed:n,cursorOffsetRef:o})}))})({isPreviousFixCanceled:e,setPreviousFixCanceled:t,blocksToBeProcessed:o,cursorOffsetRef:r});const l=V();if(null===l||!c)return;const u=Y(l);u&&(u.hasOwnProperty("content")&&s===u.content||(n(u.content),X()&&J({currentBlockId:l,isPreviousFixCanceled:e,setPreviousFixCanceled:t,blocksToBeProcessed:o,cursorOffsetRef:r})))}));return()=>{c(),(e=>{const t=window.getSelection(),s=F();if(!t)return;let n;if(null===t.anchorNode){if(null===s||null===s?.clientId)return;return n=s?.offset||0,void P(s.clientId,s.attributeKey,n+e,n+e)}1===t?.anchorNode?.nodeType&&(n=t.anchorNode?.firstChild?.length||0),3===t?.anchorNode?.nodeType&&(n=t.anchorOffset||0);const o=e>=0?n+e:n;if(1!==t?.anchorNode?.nodeType)if(3!==t?.anchorNode?.nodeType);else{const e=t.anchorNode;t.collapse(e,o)}else{const e=t.anchorNode?.firstChild||t.anchorNode?.childNodes[0];t.collapse(e,o)}})(r.current),r.current=0}}),[e,t,s,n,o,r,a])})(),(0,t.createElement)(O,null)),te=()=>(0,t.createElement)(a,null,(0,t.createElement)(ee,null));o()((()=>{(0,s.registerPlugin)("consistency-custom-sidebar",{render:te})}))})();
  • consistency/tags/1.8.2/consistency.php

    r3145550 r3184822  
    44 * Plugin URI:        https://www.webaxones.com
    55 * Description:       Fixes typographic and punctuation consistency
    6  * Version:           1.8.1
     6 * Version:           1.8.2
    77 * Requires at least: 6.1
    88 * Requires PHP:      7.4
  • consistency/tags/1.8.2/includes/Plugin.php

    r3145550 r3184822  
    3333    protected static function setConstants(): void
    3434    {
    35         defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.8.1' );
     35        defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.8.2' );
    3636        defined( __NAMESPACE__ . '\PLUGIN_URL' ) || define( __NAMESPACE__ . '\PLUGIN_URL', plugin_dir_url( __DIR__ ) );
    3737        defined( __NAMESPACE__ . '\PLUGIN_PATH' ) || define( __NAMESPACE__ . '\PLUGIN_PATH', plugin_dir_path( __DIR__ ) );
  • consistency/tags/1.8.2/package.json

    r3145550 r3184822  
    11{
    22    "name": "consistency",
    3     "version": "1.8.1",
     3    "version": "1.8.2",
    44    "description": "",
    55    "main": "index.js",
  • consistency/tags/1.8.2/readme.txt

    r3145550 r3184822  
    33Tags: punctuation, typography, block editor, gutenberg
    44Requires at least: 6.1
    5 Tested up to: 6.6
    6 Stable tag: 1.8.1
     5Tested up to: 6.7
     6Stable tag: 1.8.2
    77Requires PHP: 7.4
    88License: GPL-3.0-or-later
     
    7070== Changelog ==
    7171
     72= 1.8.2 =
     73* Fix: Fix cursor repositionning which was buggy since wp6.6
     74* Fix: Disable number suffix correction while waiting to recode it using formats
     75* Add: Indicate compatibility with WordPress 6.7
     76
    7277= 1.8.1 =
    7378* Fix: Resolves incompatibilities with block plugins such as Kadence, GeneratePress, etc.
  • consistency/tags/1.8.2/src/app/checks.js

    r3145550 r3184822  
    8282 * Checks if the regex processes a pair
    8383 *
    84  * @param {string} reg regex
     84 * @param {string} rule regex
    8585 * @return {boolean} Does the regex process a pair?
    8686 */
    87 export const regDealWithPair = reg => {
     87export const regDealWithPair = rule => {
    8888
    89     if ( pairedCharacterSlugs.includes( reg.slug ) ) {
     89    if ( pairedCharacterSlugs.includes( rule.slug ) ) {
    9090        return true
    9191    }
  • consistency/tags/1.8.2/src/app/fixes.js

    r3145550 r3184822  
    1010 */
    1111import { select, dispatch } from '@wordpress/data'
     12import { applyFormat } from '@wordpress/rich-text'
    1213
    1314/**
    1415 * External dependencies
    1516 */
    16 import { getAllInnersFromParents, getOnlyTextFromBlockContent, getCursorPositionInInnerHTML } from './utils'
     17import { getAllInnersFromParents, removeHTMLTagsFromBlockContent, getCursorPositionInInnerHTML } from './utils'
    1718import { getReplacementStringForPairs, getLocalizedRules } from './helpers'
    1819import { updateBlockTextContent } from './data'
     
    2122
    2223const { getBlock, getBlocks, getBlockAttributes, getSelectionStart, isTyping } = select( 'core/block-editor' )
    23 const { updateBlockAttributes } = dispatch( 'core/block-editor' )
     24const { updateBlockAttributes, updateBlock } = dispatch( 'core/block-editor' )
    2425
    2526
     
    5455
    5556    // Loop on localized rules to check if the block content matches one regex
    56     Object.entries( localizedRules ).forEach( ( [ _, reg ] ) => {
     57    Object.entries( localizedRules ).forEach( ( [ _, rule ] ) => {
    5758
    5859        // Stop correction if block content has already been updated
    5960        if ( contentUpdated ) return
    6061
    61         let replaceWithThis = reg.replace
     62        if ( rule.format !== '' ) return
     63
     64        const isRichTextValueObject = ( typeof blockAttributes.content === 'object' )
     65
     66        let replaceWithThis = rule.replace
    6267        let firstPart = ''
    6368        let lastPart = ''
     
    6570        let cursorPositionInsideHTML = 0
    6671        let selectionStart
    67 
     72        let richTextValueObject = ( typeof blockAttributes.content === 'object' ) ? blockAttributes.content : {}
    6873        let blockContent = ( typeof blockAttributes.content === 'object' ) ? blockAttributes.content.text : blockAttributes.content
    69        
     74
    7075        // Remove 'code' 'pre' and 'kbd' and other HTML tags from block content
    71         let textContent = getOnlyTextFromBlockContent( blockContent )
     76        let textContent = removeHTMLTagsFromBlockContent( blockContent )
    7277       
    7378        // Check if the block's text content matches the regex in the case of pasted content
     
    7580        let isConcerned = false
    7681        if ( ! isTyping() ) {
    77             isConcerned = reg.mask.test( textContent )
     82            isConcerned = rule.mask.test( textContent )
    7883        }
    7984       
     
    8489            // Get cursor position in textContent (without tags): needed for further cursor repositioning
    8590            selectionStart = getSelectionStart()
    86            
    8791            cursorPosition = selectionStart?.offset || document.getSelection()?.anchorOffset || 0
    8892
     
    9195           
    9296            // If the rule depends on previous characters, we need to separate the string taking those characters into account
    93             const captureGroups = textContent.match( reg.mask )
     97            const captureGroups = textContent.match( rule.mask )
    9498           
    9599            if( null === captureGroups || 0 === captureGroups.length ) return
     
    104108            // it means that a character has been typed uncorrected voluntarily before with CTRL Z/CMD Z
    105109            // so it should not be taken into account
    106             isConcerned = reg.mask.test( textContent ) && reg.mask.test( lastPart )
     110            isConcerned = rule.mask.test( textContent ) && rule.mask.test( lastPart )
    107111        }
    108112       
    109113        // Stop correction if block content isn't concerned by the regex
    110114        if ( ! isConcerned ) return
    111        
     115           
    112116        // Pairing characters need specific process for the replacement
    113         if ( regDealWithPair( reg ) ) {
    114             replaceWithThis = getReplacementStringForPairs( reg, blockContent, replaceWithThis )
     117        if ( regDealWithPair( rule ) ) {
     118            replaceWithThis = getReplacementStringForPairs( rule, blockContent, replaceWithThis )
    115119        }
    116120       
    117121        // Concat strings
    118122        if ( 0 !== cursorPositionInsideHTML ) {
    119             blockContent = firstPart + lastPart.replace( reg.mask, replaceWithThis )
     123            blockContent = firstPart + lastPart.replace( rule.mask, replaceWithThis )
    120124        }
    121125
    122126        // Pasted content innerBlocks case: no selection, no cursor position so the whole block is fixed
    123127        if ( 0 === cursorPositionInsideHTML ) {
    124             blockContent = blockContent.replace( reg.mask, reg.replace )
     128            blockContent = blockContent.replace( rule.mask, rule.replace )
    125129        }
    126130       
     
    130134            return
    131135        }
    132            
     136
    133137        // Update block text content if previous fix was not canceled
    134         if ( ! isPreviousFixCanceled ) {
     138        if ( ! isPreviousFixCanceled && rule.format === '' ) {
    135139            contentUpdated = updateBlockTextContent( { block, currentBlockId, blockAttributes, blockContent } )
    136140        }
     141
     142        // Apply superscript Format to the replaced string for specific rules
     143        // if ( ['ordinalNumberSuffix'].includes( rule.slug ) ) {
     144        //  contentUpdated = true
     145
     146        //  const startPos = cursorPosition - 3
     147        //  const endPos = cursorPosition - 1
     148        //  const newFormat = applyFormat(
     149        //      richTextValueObject,
     150        //      { type: 'superscript' },
     151        //      startPos,
     152        //      endPos
     153        //  )
     154        //  const newAttributes = {
     155        //      ...blockAttributes,
     156        //      ...newFormat,
     157        //  }
     158
     159        //  // updateBlock( currentBlockId, {
     160        //  //  ...block,
     161        //  //  attributes: { ...blockAttributes, newAttributes }
     162        //  // } )
     163        // }
    137164
    138165        // Get the number of characters moved by the replacement: needed for cursor repositioning.
    139166        // If the number depends on the replaced string length, we use a function to get it
    140         const nbMoved = typeof reg.nbMoved === 'function' ? reg.nbMoved( lastPart ) : reg.nbMoved || 0
     167        const nbMoved = typeof rule.nbMoved === 'function' ? rule.nbMoved( lastPart ) : rule.nbMoved || 0
    141168       
    142169        // Set the cursor offset
     
    182209        }
    183210   
    184         Object.entries( localizedRules ).forEach( ( [ _, reg ] ) => {
     211        Object.entries( localizedRules ).forEach( ( [ _, rule ] ) => {
    185212
    186213            // If the rule is a pair rule, we use a specific regex
    187             if ( pairedCharacterSlugs.includes( reg.slug ) ) {
    188                 const singleCharacterOfPair = reg.mask.toString().match( /(?<=\/).+?(?=\/)/g )[0]
     214            if ( pairedCharacterSlugs.includes( rule.slug ) ) {
     215                const singleCharacterOfPair = rule.mask.toString().match( /(?<=\/).+?(?=\/)/g )[0]
    189216                const realReg = new RegExp( `(?<!\=)${singleCharacterOfPair}(?!>)([^${singleCharacterOfPair}]*)(?<!\=)${singleCharacterOfPair}(?!>)`, 'g' )
    190                 newContent = newContent.replaceAll( realReg, reg.replace )
     217                newContent = newContent.replaceAll( realReg, rule.replace )
    191218            }
    192219
    193220            // If the rule is not a pair rule, we use the regex as it is
    194             if ( ! pairedCharacterSlugs.includes( reg.slug ) ) {
    195                 const stringRegex = reg.mask.toString()
     221            if ( ! pairedCharacterSlugs.includes( rule.slug ) ) {
     222                const stringRegex = rule.mask.toString()
    196223                const regWithGlobalFlag = new RegExp( stringRegex.substring( 1, stringRegex.length - 1 ), 'g' )
    197                 newContent = newContent.replaceAll( regWithGlobalFlag, reg.replace )
     224                newContent = newContent.replaceAll( regWithGlobalFlag, rule.replace )
    198225            }
    199226           
  • consistency/tags/1.8.2/src/app/helpers.js

    r3145550 r3184822  
    77
    88import { select, dispatch } from '@wordpress/data'
    9 const { getBlock, getBlocks, getBlockAttributes, getSelectionStart, isTyping } = select( 'core/block-editor' )
    10 const { selectionChange, updateBlockAttributes } = dispatch( 'core/block-editor' )
     9const { getSelectionStart } = select( 'core/block-editor' )
     10const { selectionChange } = dispatch( 'core/block-editor' )
    1111
    1212/**
     
    2525 * left and right separators are optionals
    2626 *
    27  * @param {object} reg Replacement parameters
     27 * @param {object} rule Replacement parameters
    2828 * @param {string} fullBlockContent Full block string
    2929 * @param {string} replaceWithThis Replacement string
    3030 * @return {string} replaceWithThis Replacement string
    3131 */
    32 export const getReplacementStringForPairs = ( reg, fullBlockContent, replaceWithThis ) => {
     32export const getReplacementStringForPairs = ( rule, fullBlockContent, replaceWithThis ) => {
    3333
    3434    // Get the opening and closing characters of the pair
    35     const openPairChar = reg.replace.charAt( 0 )
    36     const closPairChar = reg.replace.charAt( reg.replace.length - 1 )
     35    const openPairChar = rule.replace.charAt( 0 )
     36    const closPairChar = rule.replace.charAt( rule.replace.length - 1 )
    3737
    3838    // Get left separator and right separators
    39     const leftSep = reg.replace.substring( 1, reg.replace.indexOf( '$' ) ) || ''
     39    const leftSep = rule.replace.substring( 1, rule.replace.indexOf( '$' ) ) || ''
    4040
    4141    let rightSep = ''
    42     if ( 0 !== [ ...reg.replace.matchAll( /[0-9]/g ) ].length ) {
     42    if ( 0 !== [ ...rule.replace.matchAll( /[0-9]/g ) ].length ) {
    4343        // Right separator begins after last number from last capturing group
    44         rightSep = reg.replace.substring( [ ...reg.replace.matchAll( /[0-9]/g ) ].pop()['index'] + 1, reg.replace.length -1 )
     44        rightSep = rule.replace.substring( [ ...rule.replace.matchAll( /[0-9]/g ) ].pop()['index'] + 1, rule.replace.length -1 )
    4545    }
    4646
     
    8080export const getLocalizedRules = () => {
    8181
    82     const localizedRules = rules.filter( reg => true === getLocalizedRuleSettings()?.find( s => s.slug === reg.slug )?.value )
     82    const localizedRules = rules.filter( rule => true === getLocalizedRuleSettings()?.find( s => s.slug === rule.slug )?.value )
    8383
    8484    return localizedRules
     
    9595
    9696    const selection = window.getSelection()
     97
     98    const selectionStart = getSelectionStart()
    9799   
    98100    // Stop here if no selection or if the selection anchor node is null
     
    101103    // Get current cursor position
    102104    let cursorPosition
     105
     106    // window getSelection doesn't have what we need. Probably RichText case
     107    if ( selection.anchorNode === null ) {
     108       
     109        if ( selectionStart === null || selectionStart?.clientId === null ) {
     110            return
     111        }
     112
     113        cursorPosition = selectionStart?.offset || 0
     114        selectionChange( selectionStart.clientId, selectionStart.attributeKey, cursorPosition + cursorOffset, cursorPosition + cursorOffset )
     115        return
     116    }
    103117
    104118    // Element node case: we need to get the first text node from the element node
     
    114128    // If the cursorOffset is positive, newPosition equals cursorPosition + cursorOffset, else newPosition equals cursorPosition
    115129    const newPosition = cursorOffset >= 0 ? cursorPosition + cursorOffset : cursorPosition
    116 
     130   
    117131    // Element node
    118132    if ( selection?.anchorNode?.nodeType === 1 ) {
  • consistency/tags/1.8.2/src/app/utils.js

    r3142172 r3184822  
    2929 * @returns {string} The extracted text content.
    3030 */
    31 export const getOnlyTextFromBlockContent = blockContent => {
     31export const removeHTMLTagsFromBlockContent = blockContent => {
    3232
    3333    // Remove 'code' 'pre' and 'kbd' tags from block content
  • consistency/tags/1.8.2/src/config/rules.js

    r3142172 r3184822  
    2121        mask: /\'/, // mask
    2222        replace: '’', // replacement string
     23        format: '', // format to apply
    2324        nbMoved: 0, // number of characters less or more during replacement
    2425        category: 'apostrophe' // category of the setting
     
    3233        mask: /(?:\-)\-/,
    3334        replace: '–',
     35        format: '',
    3436        nbMoved: -1,
    3537        category: 'dash'
     
    4345        mask: /(?:\–|\-\-)\-/,
    4446        replace: '—',
     47        format: '',
    4548        nbMoved: lastPart => {
    4649            // Since we replace the string with a symbol, we must move the cursor to the left by the length of the replaced string minus 1 (1 for the symbol itself)
     
    5760        mask: /(?:\—|\–\-|\-\-\-)\-/,
    5861        replace: '⸺',
     62        format: '',
    5963        nbMoved: lastPart => {
    6064            // Since we replace the string with a symbol, we must move the cursor to the left by the length of the replaced string minus 1 (1 for the symbol itself)
     
    7074        + `<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>`,
    7175        mask: /([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/,
    72         replace: '$1<sup>$2<\/sup>$3',
     76        replace: '$1$2$3',
     77        format: 'superscript',
    7378        nbMoved: 0,
    7479        category: 'suffixe'
     
    8287        mask: /"/, // specific mask with specific process
    8388        replace: '“$1”',
     89        format: '',
    8490        nbMoved: 0,
    8591        category: 'quotation'
     
    9399        mask: /"/, // specific mask with specific process
    94100        replace: '„$1“',
     101        format: '',
    95102        nbMoved: 0,
    96103        category: 'quotation'
     
    104111        mask: /"/, // specific mask with specific process
    105112        replace: '»$1«',
     113        format: '',
    106114        nbMoved: 0,
    107115        category: 'quotation'
     
    115123        mask: /"/, // specific mask with specific process
    116124        replace: '« $1 »',
     125        format: '',
    117126        nbMoved: 1,
    118127        category: 'quotation'
     
    126135        mask: /"/, // specific mask with specific process
    127136        replace: '«$1»',
     137        format: '',
    128138        nbMoved: 0,
    129139        category: 'quotation'
     
    137147        mask: /“.*?”/, // specific mask with specific process
    138148        replace: matched => { return `« ${matched.substring( 1, matched.length - 1 )} »` },
     149        format: '',
    139150        nbMoved: 0,
    140151        category: 'quotation'
     
    148159        mask: / ([\?|\!|\:|\;|\»|\€|\$|\£|\¥|\₽|\元|\%])/,
    149160        replace: ' $1',
     161        format: '',
    150162        nbMoved: 0,
    151163        category: 'space'
     
    159171        mask: /(?<! | |&nbsp;)([\?|\!|\:|\»|\€|\$|\£|\¥|\₽|\元|\%])/,
    160172        replace: ' $1',
     173        format: '',
    161174        nbMoved: 1,
    162175        category: 'space'
     
    170183        mask: /([ | ])(?=[\?|\!|\:|\;|\%])(.)/,
    171184        replace: '$2',
     185        format: '',
    172186        nbMoved: -1,
    173187        category: 'space'
     
    181195        mask: /([\,|\…|\)|\]])(?! | |\.|\,|\d|$)(.)/,
    182196        replace: '$1 $2',
     197        format: '',
    183198        nbMoved: 1,
    184199        category: 'space'
     
    191206        mask: /(«)(?! | |&nbsp;)/,
    192207        replace: '$1 ',
     208        format: '',
    193209        nbMoved: 0,
    194210        category: 'space'
     
    201217        mask: /(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|\…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/,
    202218        replace: matched => matched.toUpperCase(),
     219        format: '',
    203220        nbMoved: 0,
    204221        category: 'case'
     
    212229        mask: /etc(\.{3})/i,
    213230        replace: matched => { return matched.substring(0, 3) + '.' },
     231        format: '',
    214232        nbMoved: -2,
    215233        category: 'ellipsis'
     
    223241        mask: /etc(\.{2})/i,
    224242        replace: matched => { return matched.substring(0, 2) + '.' },
     243        format: '',
    225244        nbMoved: -1,
    226245        category: 'ellipsis'
     
    234253        mask: /etc(\.{3}|…)/i,
    235254        replace: matched => { return matched.substring(0, 3) + '.' },
     255        format: '',
    236256        nbMoved: 0,
    237257        category: 'ellipsis'
     
    245265        mask: /\.{3}/,
    246266        replace: '…',
     267        format: '',
    247268        nbMoved: -2,
    248269        category: 'ellipsis'
     
    266287            return ' '
    267288        },
     289        format: '',
    268290        nbMoved: -2,
    269291        category: 'symbol'
     
    290312            }
    291313        },
     314        format: '',
    292315        nbMoved: -1,
    293316        category: 'symbol'
     
    340363            }
    341364        },
     365        format: '',
    342366        nbMoved: -2,
    343367        category: 'symbol'
     
    364388            }
    365389        },
     390        format: '',
    366391        nbMoved: lastPart => {
    367392            // We remove the last character of the string because the regex check the character after the string to replace
  • consistency/trunk/build/index.asset.php

    r3145550 r3184822  
    1 <?php return array('dependencies' => array('react', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-rich-text'), 'version' => 'ab0245b936622e6790c8');
     1<?php return array('dependencies' => array('react', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-rich-text'), 'version' => '71c2764f0435ef4fe22c');
  • consistency/trunk/build/index.js

    r3145550 r3184822  
    1 (()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var n in s)e.o(s,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:s[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,s=window.wp.plugins,n=window.wp.domReady;var o=e.n(n);const c=window.wp.element,r=(0,c.createContext)(),a=({children:e})=>{const[s]=(0,c.useState)(null!==document.querySelector('iframe[name="editor-canvas"]')),[n,o]=(0,c.useState)(!1),[a,i]=(0,c.useState)(""),[l,u]=(0,c.useState)([]),p=(0,c.useRef)(0),d=(0,c.useRef)(!1);return(0,t.createElement)(r.Provider,{value:{isEditorInIframe:s,isPreviousFixCanceled:n,setPreviousFixCanceled:o,previousFixCanceledContent:a,setPreviousFixCanceledContent:i,blocksToBeProcessed:l,setBlocksToBeProcessed:u,cursorOffsetRef:p,isContentPastedRef:d}},e)},i=r,l=window.wp.i18n,u=window.wp.editor,p=window.wp.data,d=window.wp.components,g=()=>(0,t.createElement)(d.Icon,{icon:(0,t.createElement)("svg",{version:"1.1",id:"consistency-plugin",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24",enableBackground:"new 0 0 24 24"},(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"4",y1:"20",x2:"7",y2:"20"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"14",y1:"20",x2:"21",y2:"20"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,t.createElement)("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:"5,20 11,4 13,4 20,20 "}))}),y=window.wp.coreData,m=window.wp.notices,h=e=>{const{settingSlug:s,settingName:n,settingDescription:o}=e,{currentUser:c}=(0,p.useSelect)((e=>({currentUser:e(y.store).getCurrentUser()})),[]),r=c&&c.id,[a,i]=(0,y.useEntityProp)("root","user","meta",r),{saveEditedEntityRecord:u}=(0,p.useDispatch)(y.store),{createNotice:g}=(0,p.useDispatch)(m.store);return(0,t.createElement)(d.ToggleControl,{label:n,help:(0,t.createElement)("span",{dangerouslySetInnerHTML:o}),checked:a?.consistency_plugin_user_settings?.find((e=>e.slug===s))?.value||!1,onChange:e=>{let t=a?.consistency_plugin_user_settings.map((t=>s===t.slug?{...t,value:e}:t));t?.find((e=>e.slug===s))||t.push({slug:s,value:e}),i({...a,consistency_plugin_user_settings:t}),u("root","user",r,{...a,meta:t}),g((0,l.__)("info","consistency"),e?sprintf((0,l.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,l.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}})},b=()=>(0,t.createElement)(d.Panel,{className:"UserSettingPanel"},(0,t.createElement)(d.PanelHeader,null,(0,t.createElement)("strong",null,(0,l.__)("Settings for my account","consistency")),(0,t.createElement)("br",null)),(0,t.createElement)("div",{style:{padding:16}},(0,t.createElement)(d.PanelRow,null,(0,t.createElement)(h,{settingSlug:"on_the_fly",settingName:(0,l.__)("On-the-fly autocorrect","consistency"),settingDescription:{__html:(0,l.__)("Enable/disable on-the-fly autocorrect","consistency")}})),(0,t.createElement)(d.PanelRow,null,(0,t.createElement)(h,{settingSlug:"on_paste",settingName:(0,l.__)("On paste autocorrect","consistency"),settingDescription:{__html:(0,l.__)("Enable/disable autocorrect on paste","consistency")}})))),f=window.wp.richText,_=e=>"string"==typeof e||e instanceof String,k=e=>"object"==typeof e&&e instanceof f.RichTextData,{getEntityRecord:w}=(0,p.select)("core"),{updateBlock:v}=(0,p.dispatch)("core/block-editor"),S=()=>{const e=w("root","site");return e?.consistency_plugin_localization_management||!0},x=()=>{const e=w("root","site");return e?.language||"en_US"},C=()=>{const e=x(),s=S()?(0,l.__)(` (${e} locale)`,"consistency"):(0,l.__)(" (all locales)","consistency");return(0,t.createElement)("span",{style:{fontWeight:"normal",fontStyle:"italic",fontSize:"smaller"}},s)},T=["regularToCurlyQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces","regularToGermanQuotes","regularToGermanBookStyleQuotes"],E=[{slug:"quote",incompatibleWith:[]},{slug:"2hyphens",incompatibleWith:[]},{slug:"3hyphens",incompatibleWith:[]},{slug:"4hyphens",incompatibleWith:[]},{slug:"ordinalNumberSuffix",incompatibleWith:[]},{slug:"regularToCurlyQuotes",incompatibleWith:["regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToGermanQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToGermanBookStyleQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToFrenchQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToFrenchQuotesWithoutSpaces",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes"]},{slug:"curlyToFrenchQuotes",incompatibleWith:["regularToCurlyQuotes"]},{slug:"breakingSpace",incompatibleWith:["spaceBefore"]},{slug:"noSpaceBefore",incompatibleWith:["spaceBefore"]},{slug:"spaceBefore",incompatibleWith:["breakingSpace","noSpaceBefore"]},{slug:"noBreakingSpaceAfter",incompatibleWith:[]},{slug:"noNonBreakingSpaceAfter",incompatibleWith:[]},{slug:"capitalizeFirstSentenceLetter",incompatibleWith:[]},{slug:"etcThreeDots",incompatibleWith:[]},{slug:"etcTwoDots",incompatibleWith:[]},{slug:"etcEllipsis",incompatibleWith:[]},{slug:"ellipsis",incompatibleWith:[]},{slug:"symbolInACircle",incompatibleWith:[]},{slug:"symbolInSmallCapsAndSuperscriptStyle",incompatibleWith:[]},{slug:"fractions",incompatibleWith:[]},{slug:"percentages",incompatibleWith:[]}],B=[{slug:"quote",name:(0,l.__)("Straight Apostrophe","consistency"),description:(0,l.__)("Replace straight apostrophes with curly apostrophes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>'</code> <span style='font-size:20px'>→</span> <code>’</code></span>",mask:/\'/,replace:"’",nbMoved:0,category:"apostrophe"},{slug:"2hyphens",name:(0,l.__)("En Dash","consistency"),description:(0,l.__)("Replace two hyphens with an en dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>--</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">–</code></span>",mask:/(?:\-)\-/,replace:"–",nbMoved:-1,category:"dash"},{slug:"3hyphens",name:(0,l.__)("Em Dash","consistency"),description:(0,l.__)("Replace three hyphens with an em dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>---</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">—</code></span>",mask:/(?:–|\-\-)\-/,replace:"—",nbMoved:e=>-(e.length-1),category:"dash"},{slug:"4hyphens",name:(0,l.__)("Two-Em Dash","consistency"),description:(0,l.__)("Replace four hyphens with two-em dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>----</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">⸺</code></span>",mask:/(?:—|–\-|\-\-\-)\-/,replace:"⸺",nbMoved:e=>-(e.length-1),category:"dash"},{slug:"ordinalNumberSuffix",name:(0,l.__)("Ordinal Number Suffix","consistency"),description:(0,l.__)("Add the sup HTML tag to ordinal number suffixes","consistency")+"<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>",mask:/([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/,replace:"$1<sup>$2</sup>$3",nbMoved:0,category:"suffixe"},{slug:"regularToCurlyQuotes",name:(0,l.__)("Curly Quotes","consistency"),description:(0,l.__)("Replace straight quotes with curly quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>“ ”</code></span>",mask:/"/,replace:"“$1”",nbMoved:0,category:"quotation"},{slug:"regularToGermanQuotes",name:(0,l.__)("German Quotes","consistency"),description:(0,l.__)("Replace straight quotes with german quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>„ “</code></span>",mask:/"/,replace:"„$1“",nbMoved:0,category:"quotation"},{slug:"regularToGermanBookStyleQuotes",name:(0,l.__)("German Book-Style Quotes","consistency"),description:(0,l.__)("Replace straight quotes with german book-style quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>» «</code></span>",mask:/"/,replace:"»$1«",nbMoved:0,category:"quotation"},{slug:"regularToFrenchQuotes",name:(0,l.__)("French Quotes with Spaces","consistency"),description:(0,l.__)("Replace straight quotes with french quotes with non-breaking spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>",mask:/"/,replace:"« $1 »",nbMoved:1,category:"quotation"},{slug:"regularToFrenchQuotesWithoutSpaces",name:(0,l.__)("French Quotes","consistency"),description:(0,l.__)("Replace straight quotes with french quotes without spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>« »</code></span>",mask:/"/,replace:"«$1»",nbMoved:0,category:"quotation"},{slug:"curlyToFrenchQuotes",name:(0,l.__)("Curly Quotes to French Quotes","consistency"),description:(0,l.__)("Replace curly quotes with french quotes with non-breaking spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>“ ”</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>",mask:/“.*?”/,replace:e=>`« ${e.substring(1,e.length-1)} »`,nbMoved:0,category:"quotation"},{slug:"breakingSpace",name:(0,l.__)("Breaking Spaces","consistency"),description:sprintf((0,l.__)("Replace a breaking space followed by a character from this list:%1$s with a non-breaking space","consistency"),"<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />"),mask:/ ([\?|\!|\:|\;|»|€|\$|£|¥|₽|元|\%])/,replace:" $1",nbMoved:0,category:"space"},{slug:"noSpaceBefore",name:(0,l.__)("No Space Before","consistency"),description:sprintf((0,l.__)("Add a non-breaking space before a character from this list:%1$s having no space before","consistency"),"<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />"),mask:/(?<! | |&nbsp;)([\?|\!|\:|»|€|\$|£|¥|₽|元|\%])/,replace:" $1",nbMoved:1,category:"space"},{slug:"spaceBefore",name:(0,l.__)("Space Before","consistency"),description:(0,l.__)("Remove any space preceding a character from this list:","consistency")+"<span style='display:block;'><code>? ! : ; %</code></span>",mask:/([ | ])(?=[\?|\!|\:|\;|\%])(.)/,replace:"$2",nbMoved:-1,category:"space"},{slug:"noBreakingSpaceAfter",name:(0,l.__)("No Breaking Space After","consistency"),description:sprintf((0,l.__)("Add a breaking space after a character from this list:%1$s when followed with another character","consistency"),"<br /><code>, … ) ]</code><br />"),mask:/([\,|…|\)|\]])(?! | |\.|\,|\d|$)(.)/,replace:"$1 $2",nbMoved:1,category:"space"},{slug:"noNonBreakingSpaceAfter",name:(0,l.__)("No Non-Breaking Space After","consistency"),description:(0,l.__)("Add a non-breaking space after open french quote having no space after","consistency"),mask:/(«)(?! | |&nbsp;)/,replace:"$1 ",nbMoved:0,category:"space"},{slug:"capitalizeFirstSentenceLetter",name:(0,l.__)("First Sentence Letter","consistency"),description:(0,l.__)("Capitalize the first letter of a sentence","consistency"),mask:/(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/,replace:e=>e.toUpperCase(),nbMoved:0,category:"case"},{slug:"etcThreeDots",name:(0,l.__)('Three Dots Following "etc"',"consistency"),description:(0,l.__)('Replace 3 dots placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc...</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{3})/i,replace:e=>e.substring(0,3)+".",nbMoved:-2,category:"ellipsis"},{slug:"etcTwoDots",name:(0,l.__)('Two Dots Following "etc"',"consistency"),description:(0,l.__)('Replace 2 dots placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc..</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{2})/i,replace:e=>e.substring(0,2)+".",nbMoved:-1,category:"ellipsis"},{slug:"etcEllipsis",name:(0,l.__)('Ellipsis Following "etc"',"consistency"),description:(0,l.__)('Replace the ellipsis placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc…</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{3}|…)/i,replace:e=>e.substring(0,3)+".",nbMoved:0,category:"ellipsis"},{slug:"ellipsis",name:(0,l.__)("Ellipsis","consistency"),description:(0,l.__)("Replaces 3 dots with ellipsis:","consistency")+"<span aria-hidden='true' style='display:block;'><code>...</code> <span style='font-size:20px'>→</span> <code>…</code></span>",mask:/\.{3}/,replace:"…",nbMoved:-2,category:"ellipsis"},{slug:"symbolInACircle",name:(0,l.__)("Symbol in a Circle","consistency"),description:(0,l.__)("Replaces 1 character placed in parentheses with a symbol","consistency")+"<span aria-hidden='true' style='display:block;'><code>(c) (p) (r)</code> <span style='font-size:20px'>→</span> <code>© ℗ ®</code></span>",mask:/(\([c|p|r])(\))/,replace:e=>{switch(e[1]){case"c":return"©";case"p":return"℗";case"r":return"®"}return" "},nbMoved:-2,category:"symbol"},{slug:"symbolInSmallCapsAndSuperscriptStyle",name:(0,l.__)("Symbol in Small Caps and Superscript Style","consistency"),description:(0,l.__)("Replaces 2-character abbreviations with a symbol in small caps and superscript style","consistency")+"<span aria-hidden='true' style='display:block;'><code>tm sm md mc</code> <span style='font-size:20px'>→</span> <code>™ ℠ 🅫 🅪</code></span>",mask:/(?<= | |\(|\[|\{|:|^)(tm|sm|md|mc)(?= | |\.|\,|\;|\:|\)|\]|\}|$)/,replace:e=>{switch(e){case"tm":return"™";case"sm":return"℠";case"md":return"🅫";case"mc":return"🅪";default:return" "}},nbMoved:-1,category:"symbol"},{slug:"fractions",name:(0,l.__)("Fractions","consistency"),description:(0,l.__)("Replaces fractions with fraction symbols:","consistency")+"<span aria-hidden='true' style='display:block;'><code>1/2 3/5 1/9</code> <span style='font-size:20px'>→</span> <code>½ ⅗ ⅑</code></span>",mask:/[1-9]\/[1-9]/,replace:e=>{switch(e){case"1/4":return"¼";case"1/2":return"½";case"3/4":return"¾";case"1/3":return"⅓";case"2/3":return"⅔";case"1/5":return"⅕";case"2/5":return"⅖";case"3/5":return"⅗";case"4/5":return"⅘";case"1/6":return"⅙";case"5/6":return"⅚";case"1/8":return"⅛";case"3/8":return"⅜";case"5/8":return"⅝";case"7/8":return"⅞";case"1/7":return"⅐";case"1/9":return"⅑";default:return" "}},nbMoved:-2,category:"symbol"},{slug:"percentages",name:(0,l.__)("Percentages","consistency"),description:(0,l.__)("Replaces percentages with percentages symbols:","consistency")+"<span aria-hidden='true' style='display:block;'><code>0/0 0/00 0/000</code> <span style='font-size:20px'>→</span> <code>% ‰ ‱</code></span>",mask:/(0\/0|0\/00|0\/000)(?= | |\.|\,|\;|\:|\)|\]|\})(.)/,replace:e=>{const t=e.substring(0,e.length-1),s=e.substring(e.length-1,e.length);switch(t){case"0/0":return"%"+s;case"0/00":return"‰"+s;case"0/000":return"‱"+s;default:return" "+s}},nbMoved:e=>-(e.substring(0,e.length-1).length-1),category:"symbol"}],{getBlock:F,getBlocks:P,getBlockAttributes:R,getSelectionStart:Q,isTyping:W}=(0,p.select)("core/block-editor"),{selectionChange:M,updateBlockAttributes:$}=(0,p.dispatch)("core/block-editor"),A=()=>{const e=(()=>{const e=w("root","site");return e?.consistency_plugin_settings||[]})();return S()?e.filter((e=>O(e.slug))):e},N=()=>B.filter((e=>!0===A()?.find((t=>t.slug===e.slug))?.value)),{getBlockName:q,getBlockAttributes:z}=(0,p.select)("core/block-editor"),O=e=>{const t=x();return!(void 0===localesByRules||!localesByRules.hasOwnProperty(e))&&localesByRules[e].includes(t)},I=e=>{const t=E.find((t=>t.slug===e));return!!t&&t.incompatibleWith.some((e=>A()?.find((t=>t.slug===e))?.value))},D=e=>{const{settingSlug:s,settingName:n,settingDescription:o}=e,{createNotice:c}=(0,p.useDispatch)(m.store);if(S()&&!O(s))return"";const[r,a]=(0,y.useEntityProp)("root","site","consistency_plugin_settings",void 0),{saveEditedEntityRecord:i}=(0,p.useDispatch)(y.store);return(0,t.createElement)(d.PanelRow,null,(0,t.createElement)(d.ToggleControl,{label:n,help:(0,t.createElement)("span",{dangerouslySetInnerHTML:o}),checked:r?.find((e=>e.slug===s))?.value||!1,disabled:I(s),onChange:e=>{let t=r.map((t=>s===t.slug?{...t,value:e}:t));a(t),i("root","site",void 0,t),c((0,l.__)("info","consistency"),e?sprintf((0,l.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,l.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}}))},L=[{slug:"apostrophe",label:(0,l.__)("Apostrophes","consistency"),description:(0,l.__)("Fixes related to apostrophes.","consistency")},{slug:"quotation",label:(0,l.__)("Quotation marks","consistency"),description:(0,l.__)("Fixes related to quotation marks.","consistency")},{slug:"dash",label:(0,l.__)("Dashes","consistency"),description:(0,l.__)("Fixes related to dashes.","consistency")},{slug:"suffixe",label:(0,l.__)("Suffixes","consistency"),description:(0,l.__)("Fixes related to suffixes.","consistency")},{slug:"space",label:(0,l.__)("Spaces","consistency"),description:(0,l.__)("Fixes related to spaces.","consistency")},{slug:"case",label:(0,l.__)("Case","consistency"),description:(0,l.__)("Fixes related to case.","consistency")},{slug:"ellipsis",label:(0,l.__)("Ellipsis","consistency"),description:(0,l.__)("Fixes related to ellipsis.","consistency")},{slug:"symbol",label:(0,l.__)("Symbols","consistency"),description:(0,l.__)("Fixes related to symbols.","consistency")}],G=()=>(0,t.createElement)(d.Panel,{className:"GlobalSettingPanel"},(0,t.createElement)(d.PanelHeader,null,(0,t.createElement)("strong",null,(0,l.__)("Global correction rules","consistency"),(0,t.createElement)(C,null))),[...L].map(((e,s)=>(0,t.createElement)(d.PanelBody,{key:s,title:(0,l.__)(e.label,"consistency"),initialOpen:!1},[...B].filter((t=>t.category===e.slug)).map(((e,s)=>(0,t.createElement)(D,{key:s,settingSlug:e.slug,settingName:e.name,settingDescription:{__html:e.description}}))))))),{canUser:j}=(0,p.select)("core"),U=()=>{const e=j("create","users");return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(u.PluginSidebar,{name:"consistency-custom-sidebar",title:(0,l.__)("Consistency","consistency"),icon:g},(0,t.createElement)(b,null),e&&(0,t.createElement)(G,null)),(0,t.createElement)(u.PluginSidebarMoreMenuItem,{target:"consistency-custom-sidebar"},(0,l.__)("Consistency Settings","consistency")))},{getBlock:H,getBlocks:K,getBlockAttributes:J,getSelectionStart:V,isTyping:X}=(0,p.select)("core/block-editor"),{updateBlockAttributes:Y}=(0,p.dispatch)("core/block-editor"),Z=e=>{const{currentBlockId:t,isPreviousFixCanceled:s,setPreviousFixCanceled:n,blocksToBeProcessed:o,cursorOffsetRef:c}=e;if(!(e=>{const{currentBlockId:t,blocksToBeProcessed:s}=e,n=q(t);return!!s.includes(n)})({currentBlockId:t,blocksToBeProcessed:o})||!(e=>{const t=z(e);return!(!t||!t.hasOwnProperty("content")||!_(t.content)&&!k(t.content))})(t))return;let r=N();const a=H(t);let i=J(t),l=!1;Object.entries(r).forEach((([e,o])=>{if(l)return;let r,u=o.replace,p="",d="",g=0,y=0,m="object"==typeof i.content?i.content.text:i.content,h=(e=>e.replace(/<\b(code|pre|kbd)\b>.*?<\/\b(code|pre|kbd)\b>/gi,"").replace(/(<([^>]+)>)/gi,""))(m),b=!1;if(X()||(b=o.mask.test(h)),X()){r=V(),g=r?.offset||document.getSelection()?.anchorOffset||0,y=(e=>{const t=document.querySelector(`#block-${e}`);if(null===t)return;const s=t.querySelector('[contenteditable="true"]')||t,n=document.getSelection(),o=n?.getRangeAt(0);if(!o||!o.collapsed)return;const c=o.cloneRange(),r=document.createTextNode("\0");c.insertNode(r);const a=s.textContent||"";let i=a.indexOf("\0");r.parentNode.removeChild(r),s.normalize();const l=(s?.innerHTML.match(/&nbsp;/g)||[]).length;return l>0&&(i=a.replace(/&nbsp;/g," ").indexOf("\0"),i=i-6*l+l),i})(t)||g;const e=h.match(o.mask);if(null===e||0===e.length)return;const s=e[0].length||1;p=h.substring(0,y-s),d=h.substring(y-s,h.length),b=o.mask.test(h)&&o.mask.test(d)}if(!b)return;if((e=>!!T.includes(e.slug))(o)&&(u=((e,t,s)=>{const n=e.replace.charAt(0),o=e.replace.charAt(e.replace.length-1),c=e.replace.substring(1,e.replace.indexOf("$"))||"";let r="";0!==[...e.replace.matchAll(/[0-9]/g)].length&&(r=e.replace.substring([...e.replace.matchAll(/[0-9]/g)].pop().index+1,e.replace.length-1));const a=new RegExp(`${n}`,"g"),i=new RegExp(`${o}`,"g");return(t.match(a)||[]).length===(t.match(i)||[]).length?n+c:r+o})(o,m)),0!==y&&(m=p+d.replace(o.mask,u)),0===y&&(m=m.replace(o.mask,o.replace)),s)return void n(!1);s||(l=(e=>{const{block:t,currentBlockId:s,blockAttributes:n,blockContent:o}=e;let c;if(k(n.content)){const e=(0,f.create)({...n.content,text:o});c=new f.RichTextData(e)}return _(n.content)&&(c=o),void 0!==c&&(v(s,{...t,attributes:{...n,content:c}}),!0)})({block:a,currentBlockId:t,blockAttributes:i,blockContent:m}));const w="function"==typeof o.nbMoved?o.nbMoved(d):o.nbMoved||0;l&&(c.current=w)}))},{getSelectedBlockClientId:ee,isTyping:te,getBlockAttributes:se}=(0,p.select)("core/block-editor"),ne=window.wp.blocks,oe=()=>((()=>{const{isEditorInIframe:e,isContentPastedRef:t}=(0,c.useContext)(i),s=(0,c.useRef)(!1);(0,c.useEffect)((()=>{if(s.current)return;const n=e=>{t.current=!0},o=e=>(e.addEventListener("paste",n),()=>{e.removeEventListener("paste",n)}),c=e?document.querySelector('iframe[name="editor-canvas"]'):document.querySelector("#editor");if(!c)return;const r=o(c);return e&&"complete"===c.contentWindow.document.readyState&&o(c),s.current=!0,r}),[e])})(),(()=>{const{isEditorInIframe:e,setPreviousFixCanceled:t}=(0,c.useContext)(i),s=(0,c.useRef)(!1);(0,c.useEffect)((()=>{if(s.current)return;const n=e=>{90===e.keyCode&&(e.ctrlKey||e.metaKey)&&t(!0)},o=e=>(e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}),c=e?document.querySelector('iframe[name="editor-canvas"]'):document.querySelector("#editor");if(!c)return;const r=o(c);return e&&"complete"===c.contentWindow.document.readyState&&o(c),s.current=!0,r}),[t])})(),(()=>{const{setBlocksToBeProcessed:e}=(0,c.useContext)(i);(0,c.useEffect)((()=>{let t=(0,ne.getBlockTypes)().filter((e=>e.attributes&&e.attributes.content&&("string"===e.attributes.content.type||"rich-text"===e.attributes.content.type)));const s=["core/html"];t=t.filter((e=>!s.includes(e.name))),console.log("Consistency - Blocks that can be processed:",t),e(t.map((e=>e.name)))}),[])})(),(()=>{const{isPreviousFixCanceled:e,setPreviousFixCanceled:t,previousFixCanceledContent:s,setPreviousFixCanceledContent:n,blocksToBeProcessed:o,cursorOffsetRef:r,isContentPastedRef:a}=(0,c.useContext)(i);r.current=r.current||0,a.current=a.current||!1,(0,c.useEffect)((()=>{const c=(0,p.subscribe)((()=>{const{onTheFly:c,onPaste:i}=(()=>{const e={onTheFly:!1,onPaste:!1},t=(0,p.select)(y.store).getCurrentUser(),s=w("root","user",t?.id||0,"consistency_plugin_user_settings"),n=s?.meta?.consistency_plugin_user_settings;return e.onTheFly=n?.find((e=>"on_the_fly"===e.slug))?.value||!1,e.onPaste=n?.find((e=>"on_paste"===e.slug))?.value||!1,e})();if(!c&&!i)return;if(void 0===A())return;if(i&&!0===a.current)return a.current=!1,void(e=>{const{isPreviousFixCanceled:t,setPreviousFixCanceled:s,blocksToBeProcessed:n,cursorOffsetRef:o}=e;let c=N();const r=K(),a=r.flatMap((({innerBlocks:e,...t})=>e.map((e=>({...t,...e}))))),i=r.reduce(((e,t)=>{let s=t.attributes?.content;return n.includes(t.name)&&void 0!==s?(Object.entries(c).forEach((([e,t])=>{if(T.includes(t.slug)){const e=t.mask.toString().match(/(?<=\/).+?(?=\/)/g)[0],n=new RegExp(`(?<!=)${e}(?!>)([^${e}]*)(?<!=)${e}(?!>)`,"g");s=s.replaceAll(n,t.replace)}if(!T.includes(t.slug)){const e=t.mask.toString(),n=new RegExp(e.substring(1,e.length-1),"g");s=s.replaceAll(n,t.replace)}})),void 0!==s&&(e[t.clientId]={content:s}),e):e}),{});Object.keys(i).length>0&&Y(Object.keys(i),i,!0),a.forEach((e=>{if(!n.includes(e.name))return;const c=e.clientId;e?.clientId&&Z({currentBlockId:c,isPreviousFixCanceled:t,setPreviousFixCanceled:s,blocksToBeProcessed:n,cursorOffsetRef:o})}))})({isPreviousFixCanceled:e,setPreviousFixCanceled:t,blocksToBeProcessed:o,cursorOffsetRef:r});const l=ee();if(null===l||!c)return;const u=se(l);u&&(u.hasOwnProperty("content")&&s===u.content||(n(u.content),te()&&Z({currentBlockId:l,isPreviousFixCanceled:e,setPreviousFixCanceled:t,blocksToBeProcessed:o,cursorOffsetRef:r})))}));return()=>{c(),(e=>{const t=window.getSelection();if(!t)return;let s;1===t?.anchorNode?.nodeType&&(s=t.anchorNode?.firstChild?.length||0),3===t?.anchorNode?.nodeType&&(s=t.anchorOffset||0);const n=e>=0?s+e:s;if(1!==t?.anchorNode?.nodeType)if(3!==t?.anchorNode?.nodeType);else{const e=t.anchorNode;t.collapse(e,n)}else{const e=t.anchorNode?.firstChild||t.anchorNode?.childNodes[0];t.collapse(e,n)}})(r.current),r.current=0}}),[e,t,s,n,o,r,a])})(),(0,t.createElement)(U,null)),ce=()=>(0,t.createElement)(a,null,(0,t.createElement)(oe,null));o()((()=>{(0,s.registerPlugin)("consistency-custom-sidebar",{render:ce})}))})();
     1(()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var n in s)e.o(s,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:s[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,s=window.wp.plugins,n=window.wp.domReady;var o=e.n(n);const c=window.wp.element,r=(0,c.createContext)(),a=({children:e})=>{const[s]=(0,c.useState)(null!==document.querySelector('iframe[name="editor-canvas"]')),[n,o]=(0,c.useState)(!1),[a,i]=(0,c.useState)(""),[l,u]=(0,c.useState)([]),d=(0,c.useRef)(0),p=(0,c.useRef)(!1);return(0,t.createElement)(r.Provider,{value:{isEditorInIframe:s,isPreviousFixCanceled:n,setPreviousFixCanceled:o,previousFixCanceledContent:a,setPreviousFixCanceledContent:i,blocksToBeProcessed:l,setBlocksToBeProcessed:u,cursorOffsetRef:d,isContentPastedRef:p}},e)},i=r,l=window.wp.i18n,u=window.wp.editor,d=window.wp.data,p=window.wp.components,y=()=>(0,t.createElement)(p.Icon,{icon:(0,t.createElement)("svg",{version:"1.1",id:"consistency-plugin",x:"0px",y:"0px",width:"24px",height:"24px",viewBox:"0 0 24 24",enableBackground:"new 0 0 24 24"},(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"4",y1:"20",x2:"7",y2:"20"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"14",y1:"20",x2:"21",y2:"20"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,t.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,t.createElement)("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:"5,20 11,4 13,4 20,20 "}))}),g=window.wp.coreData,m=window.wp.notices,h=e=>{const{settingSlug:s,settingName:n,settingDescription:o}=e,{currentUser:c}=(0,d.useSelect)((e=>({currentUser:e(g.store).getCurrentUser()})),[]),r=c&&c.id,[a,i]=(0,g.useEntityProp)("root","user","meta",r),{saveEditedEntityRecord:u}=(0,d.useDispatch)(g.store),{createNotice:y}=(0,d.useDispatch)(m.store);return(0,t.createElement)(p.ToggleControl,{label:n,help:(0,t.createElement)("span",{dangerouslySetInnerHTML:o}),checked:a?.consistency_plugin_user_settings?.find((e=>e.slug===s))?.value||!1,onChange:e=>{let t=a?.consistency_plugin_user_settings.map((t=>s===t.slug?{...t,value:e}:t));t?.find((e=>e.slug===s))||t.push({slug:s,value:e}),i({...a,consistency_plugin_user_settings:t}),u("root","user",r,{...a,meta:t}),y((0,l.__)("info","consistency"),e?sprintf((0,l.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,l.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}})},f=()=>(0,t.createElement)(p.Panel,{className:"UserSettingPanel"},(0,t.createElement)(p.PanelHeader,null,(0,t.createElement)("strong",null,(0,l.__)("Settings for my account","consistency")),(0,t.createElement)("br",null)),(0,t.createElement)("div",{style:{padding:16}},(0,t.createElement)(p.PanelRow,null,(0,t.createElement)(h,{settingSlug:"on_the_fly",settingName:(0,l.__)("On-the-fly autocorrect","consistency"),settingDescription:{__html:(0,l.__)("Enable/disable on-the-fly autocorrect","consistency")}})),(0,t.createElement)(p.PanelRow,null,(0,t.createElement)(h,{settingSlug:"on_paste",settingName:(0,l.__)("On paste autocorrect","consistency"),settingDescription:{__html:(0,l.__)("Enable/disable autocorrect on paste","consistency")}})))),b=window.wp.richText,_=e=>"string"==typeof e||e instanceof String,k=e=>"object"==typeof e&&e instanceof b.RichTextData,{getEntityRecord:w}=(0,d.select)("core"),{updateBlock:v}=(0,d.dispatch)("core/block-editor"),S=()=>{const e=w("root","site");return e?.consistency_plugin_localization_management||!0},x=()=>{const e=w("root","site");return e?.language||"en_US"},C=()=>{const e=x(),s=S()?(0,l.__)(` (${e} locale)`,"consistency"):(0,l.__)(" (all locales)","consistency");return(0,t.createElement)("span",{style:{fontWeight:"normal",fontStyle:"italic",fontSize:"smaller"}},s)},T=["regularToCurlyQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces","regularToGermanQuotes","regularToGermanBookStyleQuotes"],E=[{slug:"quote",incompatibleWith:[]},{slug:"2hyphens",incompatibleWith:[]},{slug:"3hyphens",incompatibleWith:[]},{slug:"4hyphens",incompatibleWith:[]},{slug:"ordinalNumberSuffix",incompatibleWith:[]},{slug:"regularToCurlyQuotes",incompatibleWith:["regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToGermanQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToGermanBookStyleQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToFrenchQuotes",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotesWithoutSpaces"]},{slug:"regularToFrenchQuotesWithoutSpaces",incompatibleWith:["regularToCurlyQuotes","regularToGermanQuotes","regularToGermanBookStyleQuotes","regularToFrenchQuotes"]},{slug:"curlyToFrenchQuotes",incompatibleWith:["regularToCurlyQuotes"]},{slug:"breakingSpace",incompatibleWith:["spaceBefore"]},{slug:"noSpaceBefore",incompatibleWith:["spaceBefore"]},{slug:"spaceBefore",incompatibleWith:["breakingSpace","noSpaceBefore"]},{slug:"noBreakingSpaceAfter",incompatibleWith:[]},{slug:"noNonBreakingSpaceAfter",incompatibleWith:[]},{slug:"capitalizeFirstSentenceLetter",incompatibleWith:[]},{slug:"etcThreeDots",incompatibleWith:[]},{slug:"etcTwoDots",incompatibleWith:[]},{slug:"etcEllipsis",incompatibleWith:[]},{slug:"ellipsis",incompatibleWith:[]},{slug:"symbolInACircle",incompatibleWith:[]},{slug:"symbolInSmallCapsAndSuperscriptStyle",incompatibleWith:[]},{slug:"fractions",incompatibleWith:[]},{slug:"percentages",incompatibleWith:[]}],B=[{slug:"quote",name:(0,l.__)("Straight Apostrophe","consistency"),description:(0,l.__)("Replace straight apostrophes with curly apostrophes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>'</code> <span style='font-size:20px'>→</span> <code>’</code></span>",mask:/\'/,replace:"’",format:"",nbMoved:0,category:"apostrophe"},{slug:"2hyphens",name:(0,l.__)("En Dash","consistency"),description:(0,l.__)("Replace two hyphens with an en dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>--</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">–</code></span>",mask:/(?:\-)\-/,replace:"–",format:"",nbMoved:-1,category:"dash"},{slug:"3hyphens",name:(0,l.__)("Em Dash","consistency"),description:(0,l.__)("Replace three hyphens with an em dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>---</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">—</code></span>",mask:/(?:–|\-\-)\-/,replace:"—",format:"",nbMoved:e=>-(e.length-1),category:"dash"},{slug:"4hyphens",name:(0,l.__)("Two-Em Dash","consistency"),description:(0,l.__)("Replace four hyphens with two-em dash:","consistency")+"<span aria-hidden='true' style='display:block;'><code>----</code> <span style='font-size:20px'>→</span> <code style=\"font-family:sans-serif;\">⸺</code></span>",mask:/(?:—|–\-|\-\-\-)\-/,replace:"⸺",format:"",nbMoved:e=>-(e.length-1),category:"dash"},{slug:"ordinalNumberSuffix",name:(0,l.__)("Ordinal Number Suffix","consistency"),description:(0,l.__)("Add the sup HTML tag to ordinal number suffixes","consistency")+"<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>",mask:/([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/,replace:"$1$2$3",format:"superscript",nbMoved:0,category:"suffixe"},{slug:"regularToCurlyQuotes",name:(0,l.__)("Curly Quotes","consistency"),description:(0,l.__)("Replace straight quotes with curly quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>“ ”</code></span>",mask:/"/,replace:"“$1”",format:"",nbMoved:0,category:"quotation"},{slug:"regularToGermanQuotes",name:(0,l.__)("German Quotes","consistency"),description:(0,l.__)("Replace straight quotes with german quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>„ “</code></span>",mask:/"/,replace:"„$1“",format:"",nbMoved:0,category:"quotation"},{slug:"regularToGermanBookStyleQuotes",name:(0,l.__)("German Book-Style Quotes","consistency"),description:(0,l.__)("Replace straight quotes with german book-style quotes:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>» «</code></span>",mask:/"/,replace:"»$1«",format:"",nbMoved:0,category:"quotation"},{slug:"regularToFrenchQuotes",name:(0,l.__)("French Quotes with Spaces","consistency"),description:(0,l.__)("Replace straight quotes with french quotes with non-breaking spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>",mask:/"/,replace:"« $1 »",format:"",nbMoved:1,category:"quotation"},{slug:"regularToFrenchQuotesWithoutSpaces",name:(0,l.__)("French Quotes","consistency"),description:(0,l.__)("Replace straight quotes with french quotes without spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>\" \"</code> <span style='font-size:20px'>→</span> <code>« »</code></span>",mask:/"/,replace:"«$1»",format:"",nbMoved:0,category:"quotation"},{slug:"curlyToFrenchQuotes",name:(0,l.__)("Curly Quotes to French Quotes","consistency"),description:(0,l.__)("Replace curly quotes with french quotes with non-breaking spaces:","consistency")+"<span aria-hidden='true' style='display:block;'><code>“ ”</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>",mask:/“.*?”/,replace:e=>`« ${e.substring(1,e.length-1)} »`,format:"",nbMoved:0,category:"quotation"},{slug:"breakingSpace",name:(0,l.__)("Breaking Spaces","consistency"),description:sprintf((0,l.__)("Replace a breaking space followed by a character from this list:%1$s with a non-breaking space","consistency"),"<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />"),mask:/ ([\?|\!|\:|\;|»|€|\$|£|¥|₽|元|\%])/,replace:" $1",format:"",nbMoved:0,category:"space"},{slug:"noSpaceBefore",name:(0,l.__)("No Space Before","consistency"),description:sprintf((0,l.__)("Add a non-breaking space before a character from this list:%1$s having no space before","consistency"),"<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />"),mask:/(?<! | |&nbsp;)([\?|\!|\:|»|€|\$|£|¥|₽|元|\%])/,replace:" $1",format:"",nbMoved:1,category:"space"},{slug:"spaceBefore",name:(0,l.__)("Space Before","consistency"),description:(0,l.__)("Remove any space preceding a character from this list:","consistency")+"<span style='display:block;'><code>? ! : ; %</code></span>",mask:/([ | ])(?=[\?|\!|\:|\;|\%])(.)/,replace:"$2",format:"",nbMoved:-1,category:"space"},{slug:"noBreakingSpaceAfter",name:(0,l.__)("No Breaking Space After","consistency"),description:sprintf((0,l.__)("Add a breaking space after a character from this list:%1$s when followed with another character","consistency"),"<br /><code>, … ) ]</code><br />"),mask:/([\,|…|\)|\]])(?! | |\.|\,|\d|$)(.)/,replace:"$1 $2",format:"",nbMoved:1,category:"space"},{slug:"noNonBreakingSpaceAfter",name:(0,l.__)("No Non-Breaking Space After","consistency"),description:(0,l.__)("Add a non-breaking space after open french quote having no space after","consistency"),mask:/(«)(?! | |&nbsp;)/,replace:"$1 ",format:"",nbMoved:0,category:"space"},{slug:"capitalizeFirstSentenceLetter",name:(0,l.__)("First Sentence Letter","consistency"),description:(0,l.__)("Capitalize the first letter of a sentence","consistency"),mask:/(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/,replace:e=>e.toUpperCase(),format:"",nbMoved:0,category:"case"},{slug:"etcThreeDots",name:(0,l.__)('Three Dots Following "etc"',"consistency"),description:(0,l.__)('Replace 3 dots placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc...</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{3})/i,replace:e=>e.substring(0,3)+".",format:"",nbMoved:-2,category:"ellipsis"},{slug:"etcTwoDots",name:(0,l.__)('Two Dots Following "etc"',"consistency"),description:(0,l.__)('Replace 2 dots placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc..</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{2})/i,replace:e=>e.substring(0,2)+".",format:"",nbMoved:-1,category:"ellipsis"},{slug:"etcEllipsis",name:(0,l.__)('Ellipsis Following "etc"',"consistency"),description:(0,l.__)('Replace the ellipsis placed after the abbreviation "etc" with a period:',"consistency")+"<span aria-hidden='true' style='display:block;'><code>etc…</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>",mask:/etc(\.{3}|…)/i,replace:e=>e.substring(0,3)+".",format:"",nbMoved:0,category:"ellipsis"},{slug:"ellipsis",name:(0,l.__)("Ellipsis","consistency"),description:(0,l.__)("Replaces 3 dots with ellipsis:","consistency")+"<span aria-hidden='true' style='display:block;'><code>...</code> <span style='font-size:20px'>→</span> <code>…</code></span>",mask:/\.{3}/,replace:"…",format:"",nbMoved:-2,category:"ellipsis"},{slug:"symbolInACircle",name:(0,l.__)("Symbol in a Circle","consistency"),description:(0,l.__)("Replaces 1 character placed in parentheses with a symbol","consistency")+"<span aria-hidden='true' style='display:block;'><code>(c) (p) (r)</code> <span style='font-size:20px'>→</span> <code>© ℗ ®</code></span>",mask:/(\([c|p|r])(\))/,replace:e=>{switch(e[1]){case"c":return"©";case"p":return"℗";case"r":return"®"}return" "},format:"",nbMoved:-2,category:"symbol"},{slug:"symbolInSmallCapsAndSuperscriptStyle",name:(0,l.__)("Symbol in Small Caps and Superscript Style","consistency"),description:(0,l.__)("Replaces 2-character abbreviations with a symbol in small caps and superscript style","consistency")+"<span aria-hidden='true' style='display:block;'><code>tm sm md mc</code> <span style='font-size:20px'>→</span> <code>™ ℠ 🅫 🅪</code></span>",mask:/(?<= | |\(|\[|\{|:|^)(tm|sm|md|mc)(?= | |\.|\,|\;|\:|\)|\]|\}|$)/,replace:e=>{switch(e){case"tm":return"™";case"sm":return"℠";case"md":return"🅫";case"mc":return"🅪";default:return" "}},format:"",nbMoved:-1,category:"symbol"},{slug:"fractions",name:(0,l.__)("Fractions","consistency"),description:(0,l.__)("Replaces fractions with fraction symbols:","consistency")+"<span aria-hidden='true' style='display:block;'><code>1/2 3/5 1/9</code> <span style='font-size:20px'>→</span> <code>½ ⅗ ⅑</code></span>",mask:/[1-9]\/[1-9]/,replace:e=>{switch(e){case"1/4":return"¼";case"1/2":return"½";case"3/4":return"¾";case"1/3":return"⅓";case"2/3":return"⅔";case"1/5":return"⅕";case"2/5":return"⅖";case"3/5":return"⅗";case"4/5":return"⅘";case"1/6":return"⅙";case"5/6":return"⅚";case"1/8":return"⅛";case"3/8":return"⅜";case"5/8":return"⅝";case"7/8":return"⅞";case"1/7":return"⅐";case"1/9":return"⅑";default:return" "}},format:"",nbMoved:-2,category:"symbol"},{slug:"percentages",name:(0,l.__)("Percentages","consistency"),description:(0,l.__)("Replaces percentages with percentages symbols:","consistency")+"<span aria-hidden='true' style='display:block;'><code>0/0 0/00 0/000</code> <span style='font-size:20px'>→</span> <code>% ‰ ‱</code></span>",mask:/(0\/0|0\/00|0\/000)(?= | |\.|\,|\;|\:|\)|\]|\})(.)/,replace:e=>{const t=e.substring(0,e.length-1),s=e.substring(e.length-1,e.length);switch(t){case"0/0":return"%"+s;case"0/00":return"‰"+s;case"0/000":return"‱"+s;default:return" "+s}},format:"",nbMoved:e=>-(e.substring(0,e.length-1).length-1),category:"symbol"}],{getSelectionStart:F}=(0,d.select)("core/block-editor"),{selectionChange:P}=(0,d.dispatch)("core/block-editor"),R=()=>{const e=(()=>{const e=w("root","site");return e?.consistency_plugin_settings||[]})();return S()?e.filter((e=>$(e.slug))):e},Q=()=>B.filter((e=>!0===R()?.find((t=>t.slug===e.slug))?.value)),{getBlockName:W,getBlockAttributes:M}=(0,d.select)("core/block-editor"),$=e=>{const t=x();return!(void 0===localesByRules||!localesByRules.hasOwnProperty(e))&&localesByRules[e].includes(t)},N=e=>{const t=E.find((t=>t.slug===e));return!!t&&t.incompatibleWith.some((e=>R()?.find((t=>t.slug===e))?.value))},q=e=>{const{settingSlug:s,settingName:n,settingDescription:o}=e,{createNotice:c}=(0,d.useDispatch)(m.store);if(S()&&!$(s))return"";const[r,a]=(0,g.useEntityProp)("root","site","consistency_plugin_settings",void 0),{saveEditedEntityRecord:i}=(0,d.useDispatch)(g.store);return(0,t.createElement)(p.PanelRow,null,(0,t.createElement)(p.ToggleControl,{label:n,help:(0,t.createElement)("span",{dangerouslySetInnerHTML:o}),checked:r?.find((e=>e.slug===s))?.value||!1,disabled:N(s),onChange:e=>{let t=r.map((t=>s===t.slug?{...t,value:e}:t));a(t),i("root","site",void 0,t),c((0,l.__)("info","consistency"),e?sprintf((0,l.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,l.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}}))},A=[{slug:"apostrophe",label:(0,l.__)("Apostrophes","consistency"),description:(0,l.__)("Fixes related to apostrophes.","consistency")},{slug:"quotation",label:(0,l.__)("Quotation marks","consistency"),description:(0,l.__)("Fixes related to quotation marks.","consistency")},{slug:"dash",label:(0,l.__)("Dashes","consistency"),description:(0,l.__)("Fixes related to dashes.","consistency")},{slug:"suffixe",label:(0,l.__)("Suffixes","consistency"),description:(0,l.__)("Fixes related to suffixes.","consistency")},{slug:"space",label:(0,l.__)("Spaces","consistency"),description:(0,l.__)("Fixes related to spaces.","consistency")},{slug:"case",label:(0,l.__)("Case","consistency"),description:(0,l.__)("Fixes related to case.","consistency")},{slug:"ellipsis",label:(0,l.__)("Ellipsis","consistency"),description:(0,l.__)("Fixes related to ellipsis.","consistency")},{slug:"symbol",label:(0,l.__)("Symbols","consistency"),description:(0,l.__)("Fixes related to symbols.","consistency")}],z=()=>(0,t.createElement)(p.Panel,{className:"GlobalSettingPanel"},(0,t.createElement)(p.PanelHeader,null,(0,t.createElement)("strong",null,(0,l.__)("Global correction rules","consistency"),(0,t.createElement)(C,null))),[...A].map(((e,s)=>(0,t.createElement)(p.PanelBody,{key:s,title:(0,l.__)(e.label,"consistency"),initialOpen:!1},[...B].filter((t=>t.category===e.slug)).map(((e,s)=>(0,t.createElement)(q,{key:s,settingSlug:e.slug,settingName:e.name,settingDescription:{__html:e.description}}))))))),{canUser:I}=(0,d.select)("core"),O=()=>{const e=I("create","users");return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(u.PluginSidebar,{name:"consistency-custom-sidebar",title:(0,l.__)("Consistency","consistency"),icon:y},(0,t.createElement)(f,null),e&&(0,t.createElement)(z,null)),(0,t.createElement)(u.PluginSidebarMoreMenuItem,{target:"consistency-custom-sidebar"},(0,l.__)("Consistency Settings","consistency")))},{getBlock:D,getBlocks:L,getBlockAttributes:G,getSelectionStart:j,isTyping:U}=(0,d.select)("core/block-editor"),{updateBlockAttributes:H,updateBlock:K}=(0,d.dispatch)("core/block-editor"),J=e=>{const{currentBlockId:t,isPreviousFixCanceled:s,setPreviousFixCanceled:n,blocksToBeProcessed:o,cursorOffsetRef:c}=e;if(!(e=>{const{currentBlockId:t,blocksToBeProcessed:s}=e,n=W(t);return!!s.includes(n)})({currentBlockId:t,blocksToBeProcessed:o})||!(e=>{const t=M(e);return!(!t||!t.hasOwnProperty("content")||!_(t.content)&&!k(t.content))})(t))return;let r=Q();const a=D(t);let i=G(t),l=!1;Object.entries(r).forEach((([e,o])=>{if(l)return;if(""!==o.format)return;i.content;let r,u=o.replace,d="",p="",y=0,g=0,m=("object"==typeof i.content&&i.content,"object"==typeof i.content?i.content.text:i.content),h=(e=>e.replace(/<\b(code|pre|kbd)\b>.*?<\/\b(code|pre|kbd)\b>/gi,"").replace(/(<([^>]+)>)/gi,""))(m),f=!1;if(U()||(f=o.mask.test(h)),U()){r=j(),y=r?.offset||document.getSelection()?.anchorOffset||0,g=(e=>{const t=document.querySelector(`#block-${e}`);if(null===t)return;const s=t.querySelector('[contenteditable="true"]')||t,n=document.getSelection(),o=n?.getRangeAt(0);if(!o||!o.collapsed)return;const c=o.cloneRange(),r=document.createTextNode("\0");c.insertNode(r);const a=s.textContent||"";let i=a.indexOf("\0");r.parentNode.removeChild(r),s.normalize();const l=(s?.innerHTML.match(/&nbsp;/g)||[]).length;return l>0&&(i=a.replace(/&nbsp;/g," ").indexOf("\0"),i=i-6*l+l),i})(t)||y;const e=h.match(o.mask);if(null===e||0===e.length)return;const s=e[0].length||1;d=h.substring(0,g-s),p=h.substring(g-s,h.length),f=o.mask.test(h)&&o.mask.test(p)}if(!f)return;if((e=>!!T.includes(e.slug))(o)&&(u=((e,t,s)=>{const n=e.replace.charAt(0),o=e.replace.charAt(e.replace.length-1),c=e.replace.substring(1,e.replace.indexOf("$"))||"";let r="";0!==[...e.replace.matchAll(/[0-9]/g)].length&&(r=e.replace.substring([...e.replace.matchAll(/[0-9]/g)].pop().index+1,e.replace.length-1));const a=new RegExp(`${n}`,"g"),i=new RegExp(`${o}`,"g");return(t.match(a)||[]).length===(t.match(i)||[]).length?n+c:r+o})(o,m)),0!==g&&(m=d+p.replace(o.mask,u)),0===g&&(m=m.replace(o.mask,o.replace)),s)return void n(!1);s||""!==o.format||(l=(e=>{const{block:t,currentBlockId:s,blockAttributes:n,blockContent:o}=e;let c;if(k(n.content)){const e=(0,b.create)({...n.content,text:o});c=new b.RichTextData(e)}return _(n.content)&&(c=o),void 0!==c&&(v(s,{...t,attributes:{...n,content:c}}),!0)})({block:a,currentBlockId:t,blockAttributes:i,blockContent:m}));const w="function"==typeof o.nbMoved?o.nbMoved(p):o.nbMoved||0;l&&(c.current=w)}))},{getSelectedBlockClientId:V,isTyping:X,getBlockAttributes:Y}=(0,d.select)("core/block-editor"),Z=window.wp.blocks,ee=()=>((()=>{const{isEditorInIframe:e,isContentPastedRef:t}=(0,c.useContext)(i),s=(0,c.useRef)(!1);(0,c.useEffect)((()=>{if(s.current)return;const n=e=>{t.current=!0},o=e=>(e.addEventListener("paste",n),()=>{e.removeEventListener("paste",n)}),c=e?document.querySelector('iframe[name="editor-canvas"]'):document.querySelector("#editor");if(!c)return;const r=o(c);return e&&"complete"===c.contentWindow.document.readyState&&o(c),s.current=!0,r}),[e])})(),(()=>{const{isEditorInIframe:e,setPreviousFixCanceled:t}=(0,c.useContext)(i),s=(0,c.useRef)(!1);(0,c.useEffect)((()=>{if(s.current)return;const n=e=>{90===e.keyCode&&(e.ctrlKey||e.metaKey)&&t(!0)},o=e=>(e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}),c=e?document.querySelector('iframe[name="editor-canvas"]'):document.querySelector("#editor");if(!c)return;const r=o(c);return e&&"complete"===c.contentWindow.document.readyState&&o(c),s.current=!0,r}),[t])})(),(()=>{const{setBlocksToBeProcessed:e}=(0,c.useContext)(i);(0,c.useEffect)((()=>{let t=(0,Z.getBlockTypes)().filter((e=>e.attributes&&e.attributes.content&&("string"===e.attributes.content.type||"rich-text"===e.attributes.content.type)));const s=["core/html"];t=t.filter((e=>!s.includes(e.name))),console.log("Consistency - Blocks that can be processed:",t),e(t.map((e=>e.name)))}),[])})(),(()=>{const{isPreviousFixCanceled:e,setPreviousFixCanceled:t,previousFixCanceledContent:s,setPreviousFixCanceledContent:n,blocksToBeProcessed:o,cursorOffsetRef:r,isContentPastedRef:a}=(0,c.useContext)(i);r.current=r.current||0,a.current=a.current||!1,(0,c.useEffect)((()=>{const c=(0,d.subscribe)((()=>{const{onTheFly:c,onPaste:i}=(()=>{const e={onTheFly:!1,onPaste:!1},t=(0,d.select)(g.store).getCurrentUser(),s=w("root","user",t?.id||0,"consistency_plugin_user_settings"),n=s?.meta?.consistency_plugin_user_settings;return e.onTheFly=n?.find((e=>"on_the_fly"===e.slug))?.value||!1,e.onPaste=n?.find((e=>"on_paste"===e.slug))?.value||!1,e})();if(!c&&!i)return;if(void 0===R())return;if(i&&!0===a.current)return a.current=!1,void(e=>{const{isPreviousFixCanceled:t,setPreviousFixCanceled:s,blocksToBeProcessed:n,cursorOffsetRef:o}=e;let c=Q();const r=L(),a=r.flatMap((({innerBlocks:e,...t})=>e.map((e=>({...t,...e}))))),i=r.reduce(((e,t)=>{let s=t.attributes?.content;return n.includes(t.name)&&void 0!==s?(Object.entries(c).forEach((([e,t])=>{if(T.includes(t.slug)){const e=t.mask.toString().match(/(?<=\/).+?(?=\/)/g)[0],n=new RegExp(`(?<!=)${e}(?!>)([^${e}]*)(?<!=)${e}(?!>)`,"g");s=s.replaceAll(n,t.replace)}if(!T.includes(t.slug)){const e=t.mask.toString(),n=new RegExp(e.substring(1,e.length-1),"g");s=s.replaceAll(n,t.replace)}})),void 0!==s&&(e[t.clientId]={content:s}),e):e}),{});Object.keys(i).length>0&&H(Object.keys(i),i,!0),a.forEach((e=>{if(!n.includes(e.name))return;const c=e.clientId;e?.clientId&&J({currentBlockId:c,isPreviousFixCanceled:t,setPreviousFixCanceled:s,blocksToBeProcessed:n,cursorOffsetRef:o})}))})({isPreviousFixCanceled:e,setPreviousFixCanceled:t,blocksToBeProcessed:o,cursorOffsetRef:r});const l=V();if(null===l||!c)return;const u=Y(l);u&&(u.hasOwnProperty("content")&&s===u.content||(n(u.content),X()&&J({currentBlockId:l,isPreviousFixCanceled:e,setPreviousFixCanceled:t,blocksToBeProcessed:o,cursorOffsetRef:r})))}));return()=>{c(),(e=>{const t=window.getSelection(),s=F();if(!t)return;let n;if(null===t.anchorNode){if(null===s||null===s?.clientId)return;return n=s?.offset||0,void P(s.clientId,s.attributeKey,n+e,n+e)}1===t?.anchorNode?.nodeType&&(n=t.anchorNode?.firstChild?.length||0),3===t?.anchorNode?.nodeType&&(n=t.anchorOffset||0);const o=e>=0?n+e:n;if(1!==t?.anchorNode?.nodeType)if(3!==t?.anchorNode?.nodeType);else{const e=t.anchorNode;t.collapse(e,o)}else{const e=t.anchorNode?.firstChild||t.anchorNode?.childNodes[0];t.collapse(e,o)}})(r.current),r.current=0}}),[e,t,s,n,o,r,a])})(),(0,t.createElement)(O,null)),te=()=>(0,t.createElement)(a,null,(0,t.createElement)(ee,null));o()((()=>{(0,s.registerPlugin)("consistency-custom-sidebar",{render:te})}))})();
  • consistency/trunk/consistency.php

    r3145550 r3184822  
    44 * Plugin URI:        https://www.webaxones.com
    55 * Description:       Fixes typographic and punctuation consistency
    6  * Version:           1.8.1
     6 * Version:           1.8.2
    77 * Requires at least: 6.1
    88 * Requires PHP:      7.4
  • consistency/trunk/includes/Plugin.php

    r3145550 r3184822  
    3333    protected static function setConstants(): void
    3434    {
    35         defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.8.1' );
     35        defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.8.2' );
    3636        defined( __NAMESPACE__ . '\PLUGIN_URL' ) || define( __NAMESPACE__ . '\PLUGIN_URL', plugin_dir_url( __DIR__ ) );
    3737        defined( __NAMESPACE__ . '\PLUGIN_PATH' ) || define( __NAMESPACE__ . '\PLUGIN_PATH', plugin_dir_path( __DIR__ ) );
  • consistency/trunk/package.json

    r3145550 r3184822  
    11{
    22    "name": "consistency",
    3     "version": "1.8.1",
     3    "version": "1.8.2",
    44    "description": "",
    55    "main": "index.js",
  • consistency/trunk/readme.txt

    r3145550 r3184822  
    33Tags: punctuation, typography, block editor, gutenberg
    44Requires at least: 6.1
    5 Tested up to: 6.6
    6 Stable tag: 1.8.1
     5Tested up to: 6.7
     6Stable tag: 1.8.2
    77Requires PHP: 7.4
    88License: GPL-3.0-or-later
     
    7070== Changelog ==
    7171
     72= 1.8.2 =
     73* Fix: Fix cursor repositionning which was buggy since wp6.6
     74* Fix: Disable number suffix correction while waiting to recode it using formats
     75* Add: Indicate compatibility with WordPress 6.7
     76
    7277= 1.8.1 =
    7378* Fix: Resolves incompatibilities with block plugins such as Kadence, GeneratePress, etc.
  • consistency/trunk/src/app/checks.js

    r3145550 r3184822  
    8282 * Checks if the regex processes a pair
    8383 *
    84  * @param {string} reg regex
     84 * @param {string} rule regex
    8585 * @return {boolean} Does the regex process a pair?
    8686 */
    87 export const regDealWithPair = reg => {
     87export const regDealWithPair = rule => {
    8888
    89     if ( pairedCharacterSlugs.includes( reg.slug ) ) {
     89    if ( pairedCharacterSlugs.includes( rule.slug ) ) {
    9090        return true
    9191    }
  • consistency/trunk/src/app/fixes.js

    r3145550 r3184822  
    1010 */
    1111import { select, dispatch } from '@wordpress/data'
     12import { applyFormat } from '@wordpress/rich-text'
    1213
    1314/**
    1415 * External dependencies
    1516 */
    16 import { getAllInnersFromParents, getOnlyTextFromBlockContent, getCursorPositionInInnerHTML } from './utils'
     17import { getAllInnersFromParents, removeHTMLTagsFromBlockContent, getCursorPositionInInnerHTML } from './utils'
    1718import { getReplacementStringForPairs, getLocalizedRules } from './helpers'
    1819import { updateBlockTextContent } from './data'
     
    2122
    2223const { getBlock, getBlocks, getBlockAttributes, getSelectionStart, isTyping } = select( 'core/block-editor' )
    23 const { updateBlockAttributes } = dispatch( 'core/block-editor' )
     24const { updateBlockAttributes, updateBlock } = dispatch( 'core/block-editor' )
    2425
    2526
     
    5455
    5556    // Loop on localized rules to check if the block content matches one regex
    56     Object.entries( localizedRules ).forEach( ( [ _, reg ] ) => {
     57    Object.entries( localizedRules ).forEach( ( [ _, rule ] ) => {
    5758
    5859        // Stop correction if block content has already been updated
    5960        if ( contentUpdated ) return
    6061
    61         let replaceWithThis = reg.replace
     62        if ( rule.format !== '' ) return
     63
     64        const isRichTextValueObject = ( typeof blockAttributes.content === 'object' )
     65
     66        let replaceWithThis = rule.replace
    6267        let firstPart = ''
    6368        let lastPart = ''
     
    6570        let cursorPositionInsideHTML = 0
    6671        let selectionStart
    67 
     72        let richTextValueObject = ( typeof blockAttributes.content === 'object' ) ? blockAttributes.content : {}
    6873        let blockContent = ( typeof blockAttributes.content === 'object' ) ? blockAttributes.content.text : blockAttributes.content
    69        
     74
    7075        // Remove 'code' 'pre' and 'kbd' and other HTML tags from block content
    71         let textContent = getOnlyTextFromBlockContent( blockContent )
     76        let textContent = removeHTMLTagsFromBlockContent( blockContent )
    7277       
    7378        // Check if the block's text content matches the regex in the case of pasted content
     
    7580        let isConcerned = false
    7681        if ( ! isTyping() ) {
    77             isConcerned = reg.mask.test( textContent )
     82            isConcerned = rule.mask.test( textContent )
    7883        }
    7984       
     
    8489            // Get cursor position in textContent (without tags): needed for further cursor repositioning
    8590            selectionStart = getSelectionStart()
    86            
    8791            cursorPosition = selectionStart?.offset || document.getSelection()?.anchorOffset || 0
    8892
     
    9195           
    9296            // If the rule depends on previous characters, we need to separate the string taking those characters into account
    93             const captureGroups = textContent.match( reg.mask )
     97            const captureGroups = textContent.match( rule.mask )
    9498           
    9599            if( null === captureGroups || 0 === captureGroups.length ) return
     
    104108            // it means that a character has been typed uncorrected voluntarily before with CTRL Z/CMD Z
    105109            // so it should not be taken into account
    106             isConcerned = reg.mask.test( textContent ) && reg.mask.test( lastPart )
     110            isConcerned = rule.mask.test( textContent ) && rule.mask.test( lastPart )
    107111        }
    108112       
    109113        // Stop correction if block content isn't concerned by the regex
    110114        if ( ! isConcerned ) return
    111        
     115           
    112116        // Pairing characters need specific process for the replacement
    113         if ( regDealWithPair( reg ) ) {
    114             replaceWithThis = getReplacementStringForPairs( reg, blockContent, replaceWithThis )
     117        if ( regDealWithPair( rule ) ) {
     118            replaceWithThis = getReplacementStringForPairs( rule, blockContent, replaceWithThis )
    115119        }
    116120       
    117121        // Concat strings
    118122        if ( 0 !== cursorPositionInsideHTML ) {
    119             blockContent = firstPart + lastPart.replace( reg.mask, replaceWithThis )
     123            blockContent = firstPart + lastPart.replace( rule.mask, replaceWithThis )
    120124        }
    121125
    122126        // Pasted content innerBlocks case: no selection, no cursor position so the whole block is fixed
    123127        if ( 0 === cursorPositionInsideHTML ) {
    124             blockContent = blockContent.replace( reg.mask, reg.replace )
     128            blockContent = blockContent.replace( rule.mask, rule.replace )
    125129        }
    126130       
     
    130134            return
    131135        }
    132            
     136
    133137        // Update block text content if previous fix was not canceled
    134         if ( ! isPreviousFixCanceled ) {
     138        if ( ! isPreviousFixCanceled && rule.format === '' ) {
    135139            contentUpdated = updateBlockTextContent( { block, currentBlockId, blockAttributes, blockContent } )
    136140        }
     141
     142        // Apply superscript Format to the replaced string for specific rules
     143        // if ( ['ordinalNumberSuffix'].includes( rule.slug ) ) {
     144        //  contentUpdated = true
     145
     146        //  const startPos = cursorPosition - 3
     147        //  const endPos = cursorPosition - 1
     148        //  const newFormat = applyFormat(
     149        //      richTextValueObject,
     150        //      { type: 'superscript' },
     151        //      startPos,
     152        //      endPos
     153        //  )
     154        //  const newAttributes = {
     155        //      ...blockAttributes,
     156        //      ...newFormat,
     157        //  }
     158
     159        //  // updateBlock( currentBlockId, {
     160        //  //  ...block,
     161        //  //  attributes: { ...blockAttributes, newAttributes }
     162        //  // } )
     163        // }
    137164
    138165        // Get the number of characters moved by the replacement: needed for cursor repositioning.
    139166        // If the number depends on the replaced string length, we use a function to get it
    140         const nbMoved = typeof reg.nbMoved === 'function' ? reg.nbMoved( lastPart ) : reg.nbMoved || 0
     167        const nbMoved = typeof rule.nbMoved === 'function' ? rule.nbMoved( lastPart ) : rule.nbMoved || 0
    141168       
    142169        // Set the cursor offset
     
    182209        }
    183210   
    184         Object.entries( localizedRules ).forEach( ( [ _, reg ] ) => {
     211        Object.entries( localizedRules ).forEach( ( [ _, rule ] ) => {
    185212
    186213            // If the rule is a pair rule, we use a specific regex
    187             if ( pairedCharacterSlugs.includes( reg.slug ) ) {
    188                 const singleCharacterOfPair = reg.mask.toString().match( /(?<=\/).+?(?=\/)/g )[0]
     214            if ( pairedCharacterSlugs.includes( rule.slug ) ) {
     215                const singleCharacterOfPair = rule.mask.toString().match( /(?<=\/).+?(?=\/)/g )[0]
    189216                const realReg = new RegExp( `(?<!\=)${singleCharacterOfPair}(?!>)([^${singleCharacterOfPair}]*)(?<!\=)${singleCharacterOfPair}(?!>)`, 'g' )
    190                 newContent = newContent.replaceAll( realReg, reg.replace )
     217                newContent = newContent.replaceAll( realReg, rule.replace )
    191218            }
    192219
    193220            // If the rule is not a pair rule, we use the regex as it is
    194             if ( ! pairedCharacterSlugs.includes( reg.slug ) ) {
    195                 const stringRegex = reg.mask.toString()
     221            if ( ! pairedCharacterSlugs.includes( rule.slug ) ) {
     222                const stringRegex = rule.mask.toString()
    196223                const regWithGlobalFlag = new RegExp( stringRegex.substring( 1, stringRegex.length - 1 ), 'g' )
    197                 newContent = newContent.replaceAll( regWithGlobalFlag, reg.replace )
     224                newContent = newContent.replaceAll( regWithGlobalFlag, rule.replace )
    198225            }
    199226           
  • consistency/trunk/src/app/helpers.js

    r3145550 r3184822  
    77
    88import { select, dispatch } from '@wordpress/data'
    9 const { getBlock, getBlocks, getBlockAttributes, getSelectionStart, isTyping } = select( 'core/block-editor' )
    10 const { selectionChange, updateBlockAttributes } = dispatch( 'core/block-editor' )
     9const { getSelectionStart } = select( 'core/block-editor' )
     10const { selectionChange } = dispatch( 'core/block-editor' )
    1111
    1212/**
     
    2525 * left and right separators are optionals
    2626 *
    27  * @param {object} reg Replacement parameters
     27 * @param {object} rule Replacement parameters
    2828 * @param {string} fullBlockContent Full block string
    2929 * @param {string} replaceWithThis Replacement string
    3030 * @return {string} replaceWithThis Replacement string
    3131 */
    32 export const getReplacementStringForPairs = ( reg, fullBlockContent, replaceWithThis ) => {
     32export const getReplacementStringForPairs = ( rule, fullBlockContent, replaceWithThis ) => {
    3333
    3434    // Get the opening and closing characters of the pair
    35     const openPairChar = reg.replace.charAt( 0 )
    36     const closPairChar = reg.replace.charAt( reg.replace.length - 1 )
     35    const openPairChar = rule.replace.charAt( 0 )
     36    const closPairChar = rule.replace.charAt( rule.replace.length - 1 )
    3737
    3838    // Get left separator and right separators
    39     const leftSep = reg.replace.substring( 1, reg.replace.indexOf( '$' ) ) || ''
     39    const leftSep = rule.replace.substring( 1, rule.replace.indexOf( '$' ) ) || ''
    4040
    4141    let rightSep = ''
    42     if ( 0 !== [ ...reg.replace.matchAll( /[0-9]/g ) ].length ) {
     42    if ( 0 !== [ ...rule.replace.matchAll( /[0-9]/g ) ].length ) {
    4343        // Right separator begins after last number from last capturing group
    44         rightSep = reg.replace.substring( [ ...reg.replace.matchAll( /[0-9]/g ) ].pop()['index'] + 1, reg.replace.length -1 )
     44        rightSep = rule.replace.substring( [ ...rule.replace.matchAll( /[0-9]/g ) ].pop()['index'] + 1, rule.replace.length -1 )
    4545    }
    4646
     
    8080export const getLocalizedRules = () => {
    8181
    82     const localizedRules = rules.filter( reg => true === getLocalizedRuleSettings()?.find( s => s.slug === reg.slug )?.value )
     82    const localizedRules = rules.filter( rule => true === getLocalizedRuleSettings()?.find( s => s.slug === rule.slug )?.value )
    8383
    8484    return localizedRules
     
    9595
    9696    const selection = window.getSelection()
     97
     98    const selectionStart = getSelectionStart()
    9799   
    98100    // Stop here if no selection or if the selection anchor node is null
     
    101103    // Get current cursor position
    102104    let cursorPosition
     105
     106    // window getSelection doesn't have what we need. Probably RichText case
     107    if ( selection.anchorNode === null ) {
     108       
     109        if ( selectionStart === null || selectionStart?.clientId === null ) {
     110            return
     111        }
     112
     113        cursorPosition = selectionStart?.offset || 0
     114        selectionChange( selectionStart.clientId, selectionStart.attributeKey, cursorPosition + cursorOffset, cursorPosition + cursorOffset )
     115        return
     116    }
    103117
    104118    // Element node case: we need to get the first text node from the element node
     
    114128    // If the cursorOffset is positive, newPosition equals cursorPosition + cursorOffset, else newPosition equals cursorPosition
    115129    const newPosition = cursorOffset >= 0 ? cursorPosition + cursorOffset : cursorPosition
    116 
     130   
    117131    // Element node
    118132    if ( selection?.anchorNode?.nodeType === 1 ) {
  • consistency/trunk/src/app/utils.js

    r3142172 r3184822  
    2929 * @returns {string} The extracted text content.
    3030 */
    31 export const getOnlyTextFromBlockContent = blockContent => {
     31export const removeHTMLTagsFromBlockContent = blockContent => {
    3232
    3333    // Remove 'code' 'pre' and 'kbd' tags from block content
  • consistency/trunk/src/config/rules.js

    r3142172 r3184822  
    2121        mask: /\'/, // mask
    2222        replace: '’', // replacement string
     23        format: '', // format to apply
    2324        nbMoved: 0, // number of characters less or more during replacement
    2425        category: 'apostrophe' // category of the setting
     
    3233        mask: /(?:\-)\-/,
    3334        replace: '–',
     35        format: '',
    3436        nbMoved: -1,
    3537        category: 'dash'
     
    4345        mask: /(?:\–|\-\-)\-/,
    4446        replace: '—',
     47        format: '',
    4548        nbMoved: lastPart => {
    4649            // Since we replace the string with a symbol, we must move the cursor to the left by the length of the replaced string minus 1 (1 for the symbol itself)
     
    5760        mask: /(?:\—|\–\-|\-\-\-)\-/,
    5861        replace: '⸺',
     62        format: '',
    5963        nbMoved: lastPart => {
    6064            // Since we replace the string with a symbol, we must move the cursor to the left by the length of the replaced string minus 1 (1 for the symbol itself)
     
    7074        + `<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>`,
    7175        mask: /([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/,
    72         replace: '$1<sup>$2<\/sup>$3',
     76        replace: '$1$2$3',
     77        format: 'superscript',
    7378        nbMoved: 0,
    7479        category: 'suffixe'
     
    8287        mask: /"/, // specific mask with specific process
    8388        replace: '“$1”',
     89        format: '',
    8490        nbMoved: 0,
    8591        category: 'quotation'
     
    9399        mask: /"/, // specific mask with specific process
    94100        replace: '„$1“',
     101        format: '',
    95102        nbMoved: 0,
    96103        category: 'quotation'
     
    104111        mask: /"/, // specific mask with specific process
    105112        replace: '»$1«',
     113        format: '',
    106114        nbMoved: 0,
    107115        category: 'quotation'
     
    115123        mask: /"/, // specific mask with specific process
    116124        replace: '« $1 »',
     125        format: '',
    117126        nbMoved: 1,
    118127        category: 'quotation'
     
    126135        mask: /"/, // specific mask with specific process
    127136        replace: '«$1»',
     137        format: '',
    128138        nbMoved: 0,
    129139        category: 'quotation'
     
    137147        mask: /“.*?”/, // specific mask with specific process
    138148        replace: matched => { return `« ${matched.substring( 1, matched.length - 1 )} »` },
     149        format: '',
    139150        nbMoved: 0,
    140151        category: 'quotation'
     
    148159        mask: / ([\?|\!|\:|\;|\»|\€|\$|\£|\¥|\₽|\元|\%])/,
    149160        replace: ' $1',
     161        format: '',
    150162        nbMoved: 0,
    151163        category: 'space'
     
    159171        mask: /(?<! | |&nbsp;)([\?|\!|\:|\»|\€|\$|\£|\¥|\₽|\元|\%])/,
    160172        replace: ' $1',
     173        format: '',
    161174        nbMoved: 1,
    162175        category: 'space'
     
    170183        mask: /([ | ])(?=[\?|\!|\:|\;|\%])(.)/,
    171184        replace: '$2',
     185        format: '',
    172186        nbMoved: -1,
    173187        category: 'space'
     
    181195        mask: /([\,|\…|\)|\]])(?! | |\.|\,|\d|$)(.)/,
    182196        replace: '$1 $2',
     197        format: '',
    183198        nbMoved: 1,
    184199        category: 'space'
     
    191206        mask: /(«)(?! | |&nbsp;)/,
    192207        replace: '$1 ',
     208        format: '',
    193209        nbMoved: 0,
    194210        category: 'space'
     
    201217        mask: /(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|\…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/,
    202218        replace: matched => matched.toUpperCase(),
     219        format: '',
    203220        nbMoved: 0,
    204221        category: 'case'
     
    212229        mask: /etc(\.{3})/i,
    213230        replace: matched => { return matched.substring(0, 3) + '.' },
     231        format: '',
    214232        nbMoved: -2,
    215233        category: 'ellipsis'
     
    223241        mask: /etc(\.{2})/i,
    224242        replace: matched => { return matched.substring(0, 2) + '.' },
     243        format: '',
    225244        nbMoved: -1,
    226245        category: 'ellipsis'
     
    234253        mask: /etc(\.{3}|…)/i,
    235254        replace: matched => { return matched.substring(0, 3) + '.' },
     255        format: '',
    236256        nbMoved: 0,
    237257        category: 'ellipsis'
     
    245265        mask: /\.{3}/,
    246266        replace: '…',
     267        format: '',
    247268        nbMoved: -2,
    248269        category: 'ellipsis'
     
    266287            return ' '
    267288        },
     289        format: '',
    268290        nbMoved: -2,
    269291        category: 'symbol'
     
    290312            }
    291313        },
     314        format: '',
    292315        nbMoved: -1,
    293316        category: 'symbol'
     
    340363            }
    341364        },
     365        format: '',
    342366        nbMoved: -2,
    343367        category: 'symbol'
     
    364388            }
    365389        },
     390        format: '',
    366391        nbMoved: lastPart => {
    367392            // We remove the last character of the string because the regex check the character after the string to replace
Note: See TracChangeset for help on using the changeset viewer.