Plugin Directory

Changeset 3130518


Ignore:
Timestamp:
08/04/2024 04:59:07 AM (17 months ago)
Author:
Webaxones
Message:

Update to version 1.7.0 from GitHub

Location:
consistency
Files:
8 added
45 edited
1 copied

Legend:

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

    r3122806 r3130518  
    1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-i18n', 'wp-notices', 'wp-plugins'), 'version' => 'bcd6cb4e252b3d42baa6');
     1<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-i18n', 'wp-notices', 'wp-plugins'), 'version' => 'eccd1fcee4002381057b');
  • consistency/tags/1.7.0/build/index.js

    r3122806 r3130518  
    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]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const t=window.wp.plugins,s=window.wp.data,n=window.wp.domReady;var o=e.n(n);const c=window.React,a=window.wp.i18n,r=window.wp.editPost,i=window.wp.components,l=()=>(0,c.createElement)(i.Icon,{icon:(0,c.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,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"4",y1:"20",x2:"7",y2:"20"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"14",y1:"20",x2:"21",y2:"20"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,c.createElement)("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:"5,20 11,4 13,4 20,20 "}))}),d=window.wp.coreData,p=window.wp.notices,u=e=>{const{settingSlug:t,settingName:n,settingDescription:o}=e,{currentUser:r}=(0,s.useSelect)((e=>({currentUser:e(d.store).getCurrentUser()})),[]),l=r&&r.id,[u,g]=(0,d.useEntityProp)("root","user","meta",l),{saveEditedEntityRecord:y}=(0,s.useDispatch)(d.store),{createNotice:m}=(0,s.useDispatch)(p.store);return(0,c.createElement)(i.ToggleControl,{label:n,help:(0,c.createElement)("span",{dangerouslySetInnerHTML:o}),checked:u?.consistency_plugin_user_settings?.find((e=>e.slug===t))?.value||!1,onChange:e=>{let s=u?.consistency_plugin_user_settings.map((s=>t===s.slug?{...s,value:e}:s));s?.find((e=>e.slug===t))||s.push({slug:t,value:e}),g({...u,consistency_plugin_user_settings:s}),y("root","user",l,{...u,meta:s}),m((0,a.__)("info","consistency"),e?sprintf((0,a.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,a.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}})},g=()=>(0,c.createElement)(i.Panel,{className:"UserSettingPanel"},(0,c.createElement)(i.PanelHeader,null,(0,c.createElement)("strong",null,(0,a.__)("Settings for my account","consistency"))),(0,c.createElement)("div",{style:{padding:16}},(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(u,{settingSlug:"on_the_fly",settingName:(0,a.__)("On-the-fly autocorrect","consistency"),settingDescription:{__html:(0,a.__)("Enable/disable on-the-fly autocorrect","consistency")}})),(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(u,{settingSlug:"on_paste",settingName:(0,a.__)("On paste autocorrect","consistency"),settingDescription:{__html:(0,a.__)("Enable/disable autocorrect on paste","consistency")}})))),{getEntityRecord:y}=(0,s.select)("core"),m=["regularToCurlyQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces","regularToGermanQuotes","regularToGermanBookStyleQuotes"],_=["core/paragraph","core/heading","core/quote","core/list-item","core/read-more"],{getBlock:h}=(0,s.select)("core/block-editor"),{updateBlock:b}=(0,s.dispatch)("core/block-editor"),{getBlockName:f,getBlockAttributes:k}=(0,s.select)("core/block-editor"),v=e=>{const t=(()=>{const e=y("root","site");return e?.language||"en_US"})();return!(void 0===localesByRules||!localesByRules.hasOwnProperty(e))&&localesByRules[e].includes(t)},w=e=>{const{settingSlug:t,settingName:n,settingDescription:o}=e;if(!v(t))return"";const[r,l]=(0,d.useEntityProp)("root","site","consistency_plugin_settings",void 0),{saveEditedEntityRecord:u}=(0,s.useDispatch)(d.store),{createNotice:g}=(0,s.useDispatch)(p.store);return(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(i.ToggleControl,{label:n,help:(0,c.createElement)("span",{dangerouslySetInnerHTML:o}),checked:r?.find((e=>e.slug===t))?.value||!1,onChange:e=>{let s=r.map((s=>t===s.slug?{...s,value:e}:s));s?.find((e=>e.slug===t))||s.push({slug:t,value:e}),l(s),u("root","site",void 0,s),g((0,a.__)("info","consistency"),e?sprintf((0,a.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,a.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}}))},E=[{slug:"quote",name:(0,a.__)("Straight quote","consistency"),description:(0,a.__)("Replaces straight quotes with curved quotes:","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,a.__)("En dash","consistency"),description:(0,a.__)("Replaces 2 hyphens with 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,a.__)("Em dash","consistency"),description:(0,a.__)("Replaces 3 hyphens with 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,a.__)("Two-Em dash","consistency"),description:(0,a.__)("Replaces 4 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,a.__)("Ordinal number suffix","consistency"),description:(0,a.__)("Add HTML tag sup to ordinal number suffix","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,a.__)("Curly quotes","consistency"),description:(0,a.__)("Replaces regular 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,a.__)("Regular quotes to german","consistency"),description:(0,a.__)("Replaces regular 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,a.__)("Regular quotes to german book-style quotes","consistency"),description:(0,a.__)("Replaces regular 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,a.__)("Regular quotes to french","consistency"),description:(0,a.__)("Replaces regular quotes with french quotes:","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,a.__)("Regular quotes to french quotes without spaces","consistency"),description:(0,a.__)("Replaces regular 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,a.__)("Curly quotes to french quotes","consistency"),description:(0,a.__)("Replaces curly quotes with french quotes:","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,a.__)("Breaking space","consistency"),description:sprintf((0,a.__)("Replaces 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,a.__)("No space before","consistency"),description:sprintf((0,a.__)("Adds 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,a.__)("Space before","consistency"),description:(0,a.__)("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,a.__)("No breaking space after","consistency"),description:sprintf((0,a.__)("Adds 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,a.__)("No non breaking space after","consistency"),description:(0,a.__)("Adds 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,a.__)("First sentence letter not capitalized","consistency"),description:(0,a.__)("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,a.__)('3 dots following "etc"',"consistency"),description:(0,a.__)('Replaces 3 dots placed after the abbreviation "etc" with a point:',"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,a.__)('2 dots following "etc"',"consistency"),description:(0,a.__)('Replaces 2 dots placed after the abbreviation "etc" with a point:',"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,a.__)('Ellipsis following "etc"',"consistency"),description:(0,a.__)('Replaces ellipsis placed after the abbreviation "etc" with a point:',"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,a.__)("Ellipsis","consistency"),description:(0,a.__)("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,a.__)("Symbol in a circle","consistency"),description:(0,a.__)("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,a.__)("Symbol in small caps and superscript style","consistency"),description:(0,a.__)("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,a.__)("Fractions","consistency"),description:(0,a.__)("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,a.__)("Percentages","consistency"),description:(0,a.__)("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"}],x=[{slug:"apostrophe",label:(0,a.__)("Apostrophes","consistency"),description:(0,a.__)("Fixes related to apostrophes.","consistency")},{slug:"quotation",label:(0,a.__)("Quotation marks","consistency"),description:(0,a.__)("Fixes related to quotation marks.","consistency")},{slug:"dash",label:(0,a.__)("Dashes","consistency"),description:(0,a.__)("Fixes related to dashes.","consistency")},{slug:"suffixe",label:(0,a.__)("Suffixes","consistency"),description:(0,a.__)("Fixes related to suffixes.","consistency")},{slug:"space",label:(0,a.__)("Spaces","consistency"),description:(0,a.__)("Fixes related to spaces.","consistency")},{slug:"case",label:(0,a.__)("Case","consistency"),description:(0,a.__)("Fixes related to case.","consistency")},{slug:"ellipsis",label:(0,a.__)("Ellipsis","consistency"),description:(0,a.__)("Fixes related to ellipsis.","consistency")},{slug:"symbol",label:(0,a.__)("Symbols","consistency"),description:(0,a.__)("Fixes related to symbols.","consistency")}],S=()=>(0,c.createElement)(i.Panel,{className:"GlobalSettingPanel"},(0,c.createElement)(i.PanelHeader,null,(0,c.createElement)("strong",null,(0,a.__)("Global correction rules","consistency"))),[...x].map(((e,t)=>(0,c.createElement)(i.PanelBody,{key:t,title:(0,a.__)(e.label,"consistency"),initialOpen:!1},[...E].filter((t=>t.category===e.slug)).map(((e,t)=>(0,c.createElement)(w,{key:t,settingSlug:e.slug,settingName:e.name,settingDescription:{__html:e.description}}))))))),{canUser:C}=(0,s.select)("core"),{getBlock:R,getBlocks:q,getBlockAttributes:P,getSelectionStart:M,isTyping:$}=(0,s.select)("core/block-editor"),{updateBlock:T,selectionChange:F,updateBlockAttributes:B}=(0,s.dispatch)("core/block-editor"),z=t=>{const{currentBlockId:s,isPasting:n,settings:o}=t;let c=E.filter((e=>!0===o?.find((t=>t.slug===e.slug))?.value));const a=R(s);if(!(e=>{const t=f(e);return!!_.includes(t)})(s)||!(e=>{const t=k(e);return!(!t||!t.hasOwnProperty("content")||""===t.content)})(s))return;let r=P(s),i=!1;Object.entries(c).forEach((([t,o])=>{if(!v(o.slug)||i)return;e.g.consistencyLoop++,(t=>{e.g.consistencyLoop>=100&&(t=>{const s=h(t);b(t,{...s,attributes:{...s.attributes,content:s.attributes.content.slice(-2)}}),e.g.consistency_loop=0,console.log("Consistency - a memory leak has occured during the fix of the following block:",s)})(t)})(s);let c,l=o.replace,d="",p="",u=0,g=r.content,y=(e=>e.replace(/<\b(code|pre|kbd)\b>.*?<\/\b(code|pre|kbd)\b>/gi,"").replace(/(<([^>]+)>)/gi,""))(g),_=!1;if($()||(_=o.mask.test(y)),$()){c=M(a.name),u=c?.offset||0;const e=(e=>{const t=document.querySelector(`#block-${e}`);if(null===t)return;const s=document.getSelection(),n=s?.getRangeAt(0);if(!n.collapsed)return;const o=n.cloneRange(),c=document.createTextNode("\0");o.insertNode(c);let a=t?.innerHTML?.indexOf("\0");c.parentNode.removeChild(c),t.normalize();const r=(t?.innerHTML.match(/&nbsp;/g)||[]).length;return r>0&&(a=a-6*r+r),a})(s)||u,t=y.match(o.mask);if(null===t||0===t.length)return;const n=t[0].length||1;d=g.substring(0,e-n),p=g.substring(e-n,g.length),_=o.mask.test(y)&&o.mask.test(p)}if(!_)return;if((e=>!!m.includes(e.slug))(o)&&(l=((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 a="";0!==[...e.replace.matchAll(/[0-9]/g)].length&&(a=e.replace.substring([...e.replace.matchAll(/[0-9]/g)].pop().index+1,e.replace.length-1));const r=new RegExp(`${n}`,"g"),i=new RegExp(`${o}`,"g");return(t.match(r)||[]).length===(t.match(i)||[]).length?n+c:a+o})(o,g)),0!==u&&(g=d+p.replace(o.mask,l)),0===u&&(g=g.replace(o.mask,o.replace)),e.g.previousFixCanceled)return void(e.g.previousFixCanceled=!1);if(e.g.previousFixCanceled||(T(s,{...a,attributes:{...a.attributes,content:g}}),i=!0),0===u||n)return;const f="function"==typeof o.nbMoved?o.nbMoved(p):o.nbMoved;f<0&&F(s,c.attributeKey,u+f,u+f),f>0&&F(s,c.attributeKey,u+1+f,u+f),0===f&&F(s,c.attributeKey,u,u)})),e.g.consistencyLoop=0},{getSelectedBlockClientId:A,isTyping:I,getBlockAttributes:L}=(0,s.select)("core/block-editor");(0,t.registerPlugin)("consistency-custom-sidebar",{render:()=>{const e=C("create","users");return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.PluginSidebar,{name:"consistency-custom-sidebar",title:(0,a.__)("Consistency","consistency"),icon:l},(0,c.createElement)(g,null),e&&(0,c.createElement)(S,null)),(0,c.createElement)(r.PluginSidebarMoreMenuItem,{target:"consistency-custom-sidebar"},(0,a.__)("Consistency Settings","consistency")))}}),o()((()=>{e.g.consistencyLoop=0,e.g.previousFixCanceledContent="",e.g.previousFixCanceled=!1,e.g.contentPasted=!1,e.g.isPasteEventAttached=!1,e.g.isEditorInIframe=null!==document.querySelector('iframe[name="editor-canvas"]'),document.querySelector("#editor")?.addEventListener("keydown",(t=>{90===t.keyCode&&(t.ctrlKey||t.metaKey)&&(e.g.previousFixCanceled=!0,t.preventDefault())})),(0,s.subscribe)((()=>{(()=>{if((()=>{const t=null!==document.querySelector('iframe[name="editor-canvas"]');e.g.isEditorInIframe!==t&&(e.g.isEditorInIframe=t,e.g.isPasteEventAttached=!1)})(),!e.g.isPasteEventAttached){if(e.g.isEditorInIframe){const t=document.querySelector('iframe[name="editor-canvas"]');t&&(t.onload=()=>{(t.contentDocument||t.contentWindow.document).addEventListener("paste",(t=>{e.g.contentPasted=!0,e.g.isPasteEventAttached=!0}))},"complete"===t.contentWindow.document.readyState&&t.onload())}e.g.isEditorInIframe||document.querySelector("#editor")?.addEventListener("paste",(t=>{e.g.contentPasted=!0,e.g.isPasteEventAttached=!0}))}})();const{onTheFly:t,onPaste:n}=(()=>{const e={onTheFly:!1,onPaste:!1},t=(0,s.select)(d.store).getCurrentUser(),n=y("root","user",t?.id||0,"consistency_plugin_user_settings"),o=n?.meta?.consistency_plugin_user_settings;return e.onTheFly=o?.find((e=>"on_the_fly"===e.slug))?.value||!1,e.onPaste=o?.find((e=>"on_paste"===e.slug))?.value||!1,e})();if(!t&&!n)return;const o=(()=>{const e=y("root","site"),t=e?.consistency_plugin_settings;return t})();if(void 0===o)return;if(e.g.contentPasted&&n)return void(t=>{const{settings:s}=t;let n=E.filter((e=>!0===s?.find((t=>t.slug===e.slug))?.value));const o=q(),c=o.flatMap((({innerBlocks:e,...t})=>e.map((e=>({...t,...e}))))),a=o.reduce(((e,t)=>{let s=t.attributes?.content;return _.includes(t.name)&&void 0!==s?(Object.entries(n).forEach((([e,t])=>{if(v(t.slug)){if(m.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(!m.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(a).length>0&&e.g.contentPasted&&(e.g.contentPasted=!1,B(Object.keys(a),a,!0)),e.g.contentPasted=!1,c.forEach((e=>{if(!_.includes(e.name))return;const t=e.clientId;e?.clientId&&z({currentBlockId:t,theRegs:n,isPasting:!0})}))})({settings:o});const c=A();if(null===c||e.g.contentPasted||!t)return;const a=L(c);a.hasOwnProperty("content")&&e.g.previousFixCanceledContent===a.content||(e.g.previousFixCanceledContent=a.content,I()&&z({currentBlockId:c,isPasting:!1,settings:o}))}))}))})();
     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]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const t=window.wp.plugins,s=window.wp.data,n=window.wp.domReady;var o=e.n(n);const c=window.React,a=window.wp.i18n,r=window.wp.editPost,i=window.wp.components,l=()=>(0,c.createElement)(i.Icon,{icon:(0,c.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,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"4",y1:"20",x2:"7",y2:"20"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"14",y1:"20",x2:"21",y2:"20"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,c.createElement)("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:"5,20 11,4 13,4 20,20 "}))}),u=window.wp.coreData,p=window.wp.notices,d=e=>{const{settingSlug:t,settingName:n,settingDescription:o}=e,{currentUser:r}=(0,s.useSelect)((e=>({currentUser:e(u.store).getCurrentUser()})),[]),l=r&&r.id,[d,g]=(0,u.useEntityProp)("root","user","meta",l),{saveEditedEntityRecord:y}=(0,s.useDispatch)(u.store),{createNotice:m}=(0,s.useDispatch)(p.store);return(0,c.createElement)(i.ToggleControl,{label:n,help:(0,c.createElement)("span",{dangerouslySetInnerHTML:o}),checked:d?.consistency_plugin_user_settings?.find((e=>e.slug===t))?.value||!1,onChange:e=>{let s=d?.consistency_plugin_user_settings.map((s=>t===s.slug?{...s,value:e}:s));s?.find((e=>e.slug===t))||s.push({slug:t,value:e}),g({...d,consistency_plugin_user_settings:s}),y("root","user",l,{...d,meta:s}),m((0,a.__)("info","consistency"),e?sprintf((0,a.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,a.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}})},g=()=>(0,c.createElement)(i.Panel,{className:"UserSettingPanel"},(0,c.createElement)(i.PanelHeader,null,(0,c.createElement)("strong",null,(0,a.__)("Settings for my account","consistency")),(0,c.createElement)("br",null)),(0,c.createElement)("div",{style:{padding:16}},(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(d,{settingSlug:"on_the_fly",settingName:(0,a.__)("On-the-fly autocorrect","consistency"),settingDescription:{__html:(0,a.__)("Enable/disable on-the-fly autocorrect","consistency")}})),(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(d,{settingSlug:"on_paste",settingName:(0,a.__)("On paste autocorrect","consistency"),settingDescription:{__html:(0,a.__)("Enable/disable autocorrect on paste","consistency")}})))),{getEntityRecord:y}=(0,s.select)("core"),m=()=>{const e=y("root","site"),t=e?.consistency_plugin_settings;return t},h=()=>{const e=y("root","site"),t=e?.consistency_plugin_localization_management;return t},b=()=>{const e=y("root","site");return e?.language||"en_US"},_=()=>{const e=b(),t=h()?(0,a.__)(` (${e} locale)`,"consistency"):(0,a.__)(" (all locales)","consistency");return(0,c.createElement)("span",{style:{fontWeight:"normal",fontStyle:"italic",fontSize:"smaller"}},t)},f=["regularToCurlyQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces","regularToGermanQuotes","regularToGermanBookStyleQuotes"],k=["core/paragraph","core/heading","core/quote","core/list-item","core/read-more"],{getBlock:w}=(0,s.select)("core/block-editor"),{updateBlock:v}=(0,s.dispatch)("core/block-editor"),S=[{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:[]}],{getBlockName:E,getBlockAttributes:x}=(0,s.select)("core/block-editor"),T=e=>{const t=b();return!(void 0===localesByRules||!localesByRules.hasOwnProperty(e))&&localesByRules[e].includes(t)},C=e=>{const t=S.find((t=>t.slug===e));return!!t&&t.incompatibleWith.some((e=>m()?.find((t=>t.slug===e))?.value))},F=e=>{const{settingSlug:t,settingName:n,settingDescription:o}=e,{createNotice:r}=(0,s.useDispatch)(p.store);if(h()&&!T(t))return"";const[l,d]=(0,u.useEntityProp)("root","site","consistency_plugin_settings",void 0),{saveEditedEntityRecord:g}=(0,s.useDispatch)(u.store);return(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(i.ToggleControl,{label:n,help:(0,c.createElement)("span",{dangerouslySetInnerHTML:o}),checked:l?.find((e=>e.slug===t))?.value||!1,disabled:C(t),onChange:e=>{let s=l.map((s=>t===s.slug?{...s,value:e}:s));d(s),g("root","site",void 0,s),r((0,a.__)("info","consistency"),e?sprintf((0,a.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,a.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}}))},Q=[{slug:"quote",name:(0,a.__)("Straight Apostrophe","consistency"),description:(0,a.__)("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,a.__)("En Dash","consistency"),description:(0,a.__)("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,a.__)("Em Dash","consistency"),description:(0,a.__)("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,a.__)("Two-Em Dash","consistency"),description:(0,a.__)("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,a.__)("Ordinal Number Suffix","consistency"),description:(0,a.__)("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,a.__)("Curly Quotes","consistency"),description:(0,a.__)("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,a.__)("German Quotes","consistency"),description:(0,a.__)("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,a.__)("German Book-Style Quotes","consistency"),description:(0,a.__)("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,a.__)("French Quotes with Spaces","consistency"),description:(0,a.__)("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,a.__)("French Quotes","consistency"),description:(0,a.__)("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,a.__)("Curly Quotes to French Quotes","consistency"),description:(0,a.__)("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,a.__)("Breaking Spaces","consistency"),description:sprintf((0,a.__)("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,a.__)("No Space Before","consistency"),description:sprintf((0,a.__)("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,a.__)("Space Before","consistency"),description:(0,a.__)("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,a.__)("No Breaking Space After","consistency"),description:sprintf((0,a.__)("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,a.__)("No Non-Breaking Space After","consistency"),description:(0,a.__)("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,a.__)("First Sentence Letter","consistency"),description:(0,a.__)("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,a.__)('Three Dots Following "etc"',"consistency"),description:(0,a.__)('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,a.__)('Two Dots Following "etc"',"consistency"),description:(0,a.__)('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,a.__)('Ellipsis Following "etc"',"consistency"),description:(0,a.__)('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,a.__)("Ellipsis","consistency"),description:(0,a.__)("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,a.__)("Symbol in a Circle","consistency"),description:(0,a.__)("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,a.__)("Symbol in Small Caps and Superscript Style","consistency"),description:(0,a.__)("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,a.__)("Fractions","consistency"),description:(0,a.__)("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,a.__)("Percentages","consistency"),description:(0,a.__)("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"}],B=[{slug:"apostrophe",label:(0,a.__)("Apostrophes","consistency"),description:(0,a.__)("Fixes related to apostrophes.","consistency")},{slug:"quotation",label:(0,a.__)("Quotation marks","consistency"),description:(0,a.__)("Fixes related to quotation marks.","consistency")},{slug:"dash",label:(0,a.__)("Dashes","consistency"),description:(0,a.__)("Fixes related to dashes.","consistency")},{slug:"suffixe",label:(0,a.__)("Suffixes","consistency"),description:(0,a.__)("Fixes related to suffixes.","consistency")},{slug:"space",label:(0,a.__)("Spaces","consistency"),description:(0,a.__)("Fixes related to spaces.","consistency")},{slug:"case",label:(0,a.__)("Case","consistency"),description:(0,a.__)("Fixes related to case.","consistency")},{slug:"ellipsis",label:(0,a.__)("Ellipsis","consistency"),description:(0,a.__)("Fixes related to ellipsis.","consistency")},{slug:"symbol",label:(0,a.__)("Symbols","consistency"),description:(0,a.__)("Fixes related to symbols.","consistency")}],P=()=>(0,c.createElement)(i.Panel,{className:"GlobalSettingPanel"},(0,c.createElement)(i.PanelHeader,null,(0,c.createElement)("strong",null,(0,a.__)("Global correction rules","consistency"),(0,c.createElement)(_,null))),[...B].map(((e,t)=>(0,c.createElement)(i.PanelBody,{key:t,title:(0,a.__)(e.label,"consistency"),initialOpen:!1},[...Q].filter((t=>t.category===e.slug)).map(((e,t)=>(0,c.createElement)(F,{key:t,settingSlug:e.slug,settingName:e.name,settingDescription:{__html:e.description}}))))))),{canUser:W}=(0,s.select)("core"),{getBlock:R,getBlocks:M,getBlockAttributes:$,getSelectionStart:A,isTyping:q}=(0,s.select)("core/block-editor"),{updateBlock:z,selectionChange:I,updateBlockAttributes:L}=(0,s.dispatch)("core/block-editor"),D=t=>{const{currentBlockId:s,isPasting:n,settings:o}=t;let c=Q.filter((e=>!0===o?.find((t=>t.slug===e.slug))?.value));const a=R(s);if(!(e=>{const t=E(e);return!!k.includes(t)})(s)||!(e=>{const t=x(e);return!(!t||!t.hasOwnProperty("content")||""===t.content)})(s))return;let r=$(s),i=!1;Object.entries(c).forEach((([t,o])=>{if(!T(o.slug)||i)return;e.g.consistencyLoop++,(t=>{e.g.consistencyLoop>=100&&(t=>{const s=w(t);v(t,{...s,attributes:{...s.attributes,content:s.attributes.content.slice(-2)}}),e.g.consistency_loop=0,console.log("Consistency - a memory leak has occured during the fix of the following block:",s)})(t)})(s);let c,l=o.replace,u="",p="",d=0,g=r.content,y=(e=>e.replace(/<\b(code|pre|kbd)\b>.*?<\/\b(code|pre|kbd)\b>/gi,"").replace(/(<([^>]+)>)/gi,""))(g),m=!1;if(q()||(m=o.mask.test(y)),q()){c=A(a.name),d=c?.offset||0;const e=(e=>{const t=document.querySelector(`#block-${e}`);if(null===t)return;const s=document.getSelection(),n=s?.getRangeAt(0);if(!n.collapsed)return;const o=n.cloneRange(),c=document.createTextNode("\0");o.insertNode(c);let a=t?.innerHTML?.indexOf("\0");c.parentNode.removeChild(c),t.normalize();const r=(t?.innerHTML.match(/&nbsp;/g)||[]).length;return r>0&&(a=a-6*r+r),a})(s)||d,t=y.match(o.mask);if(null===t||0===t.length)return;const n=t[0].length||1;u=g.substring(0,e-n),p=g.substring(e-n,g.length),m=o.mask.test(y)&&o.mask.test(p)}if(!m)return;if((e=>!!f.includes(e.slug))(o)&&(l=((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 a="";0!==[...e.replace.matchAll(/[0-9]/g)].length&&(a=e.replace.substring([...e.replace.matchAll(/[0-9]/g)].pop().index+1,e.replace.length-1));const r=new RegExp(`${n}`,"g"),i=new RegExp(`${o}`,"g");return(t.match(r)||[]).length===(t.match(i)||[]).length?n+c:a+o})(o,g)),0!==d&&(g=u+p.replace(o.mask,l)),0===d&&(g=g.replace(o.mask,o.replace)),e.g.previousFixCanceled)return void(e.g.previousFixCanceled=!1);if(e.g.previousFixCanceled||(z(s,{...a,attributes:{...a.attributes,content:g}}),i=!0),0===d||n)return;const h="function"==typeof o.nbMoved?o.nbMoved(p):o.nbMoved;h<0&&I(s,c.attributeKey,d+h,d+h),h>0&&I(s,c.attributeKey,d+1+h,d+h),0===h&&I(s,c.attributeKey,d,d)})),e.g.consistencyLoop=0},{getSelectedBlockClientId:N,isTyping:G,getBlockAttributes:O}=(0,s.select)("core/block-editor");(0,t.registerPlugin)("consistency-custom-sidebar",{render:()=>{const e=W("create","users");return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.PluginSidebar,{name:"consistency-custom-sidebar",title:(0,a.__)("Consistency","consistency"),icon:l},(0,c.createElement)(g,null),e&&(0,c.createElement)(P,null)),(0,c.createElement)(r.PluginSidebarMoreMenuItem,{target:"consistency-custom-sidebar"},(0,a.__)("Consistency Settings","consistency")))}}),o()((()=>{e.g.consistencyLoop=0,e.g.previousFixCanceledContent="",e.g.previousFixCanceled=!1,e.g.contentPasted=!1,e.g.isPasteEventAttached=!1,e.g.isEditorInIframe=null!==document.querySelector('iframe[name="editor-canvas"]'),document.querySelector("#editor")?.addEventListener("keydown",(t=>{90===t.keyCode&&(t.ctrlKey||t.metaKey)&&(e.g.previousFixCanceled=!0,t.preventDefault())})),(0,s.subscribe)((()=>{(()=>{if((()=>{const t=null!==document.querySelector('iframe[name="editor-canvas"]');e.g.isEditorInIframe!==t&&(e.g.isEditorInIframe=t,e.g.isPasteEventAttached=!1)})(),!e.g.isPasteEventAttached){if(e.g.isEditorInIframe){const t=document.querySelector('iframe[name="editor-canvas"]');t&&(t.onload=()=>{(t.contentDocument||t.contentWindow.document).addEventListener("paste",(t=>{e.g.contentPasted=!0,e.g.isPasteEventAttached=!0}))},"complete"===t.contentWindow.document.readyState&&t.onload())}e.g.isEditorInIframe||document.querySelector("#editor")?.addEventListener("paste",(t=>{e.g.contentPasted=!0,e.g.isPasteEventAttached=!0}))}})();const{onTheFly:t,onPaste:n}=(()=>{const e={onTheFly:!1,onPaste:!1},t=(0,s.select)(u.store).getCurrentUser(),n=y("root","user",t?.id||0,"consistency_plugin_user_settings"),o=n?.meta?.consistency_plugin_user_settings;return e.onTheFly=o?.find((e=>"on_the_fly"===e.slug))?.value||!1,e.onPaste=o?.find((e=>"on_paste"===e.slug))?.value||!1,e})();if(!t&&!n)return;const o=m();if(void 0===o)return;if(e.g.contentPasted&&n)return void(t=>{const{settings:s}=t;let n=Q.filter((e=>!0===s?.find((t=>t.slug===e.slug))?.value));const o=M(),c=o.flatMap((({innerBlocks:e,...t})=>e.map((e=>({...t,...e}))))),a=o.reduce(((e,t)=>{let s=t.attributes?.content;return k.includes(t.name)&&void 0!==s?(Object.entries(n).forEach((([e,t])=>{if(T(t.slug)){if(f.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(!f.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(a).length>0&&e.g.contentPasted&&(e.g.contentPasted=!1,L(Object.keys(a),a,!0)),e.g.contentPasted=!1,c.forEach((e=>{if(!k.includes(e.name))return;const t=e.clientId;e?.clientId&&D({currentBlockId:t,theRegs:n,isPasting:!0})}))})({settings:o});const c=N();if(null===c||e.g.contentPasted||!t)return;const a=O(c);a.hasOwnProperty("content")&&e.g.previousFixCanceledContent===a.content||(e.g.previousFixCanceledContent=a.content,G()&&D({currentBlockId:c,isPasting:!1,settings:o}))}))}))})();
  • consistency/tags/1.7.0/changelog.txt

    r3122806 r3130518  
    22
    33This file contains only old changelog. See readme.txt for newer versions.
     4
     5= 1.5.9 =
     6* Add rule for percentages symbols
     7* Refactor some code
     8* Actualise Readme
    49
    510= 1.5.8 =
  • consistency/tags/1.7.0/consistency.php

    r3125834 r3130518  
    44 * Plugin URI:        https://www.webaxones.com
    55 * Description:       Fixes typographical consistency
    6  * Version:           1.6.5
     6 * Version:           1.7.0
    77 * Requires at least: 6.1
    88 * Requires PHP:      7.4
  • consistency/tags/1.7.0/includes/Config/RestSchema.php

    r2857933 r3130518  
    1010{
    1111    /**
    12      * Schema of Global settings in REST API
     12     * Schema of rules settings in REST API
    1313     *
    14      * @var array $globalSetting Schema of Global settings in REST API used in register_settings
     14     * @var array $ruleSettingSchema Schema of the setting in the REST API used in register_setting, which will contain the correction rules.
    1515     */
    16     public static array $globalSetting = [
     16    public static array $ruleSettingSchema = [
    1717        'items' => [
    1818            'type'       => 'object',
     
    3131     * Schema of User Meta Settings in REST API
    3232     *
    33      * @var array $userMeta Schema of User Meta Settings in REST API used in register_meta
     33     * @var array $userMetaSchema Schema of the user meta in the REST API used in register_meta, which will contain the user choices for corrections (e.g., fix on paste, on the fly).
    3434     */
    35     public static array $userMeta = [
     35    public static array $userMetaSchema = [
    3636        'items' => [
    3737            'type'       => 'object',
  • consistency/tags/1.7.0/includes/Config/UserSettings.php

    r2857933 r3130518  
    2626            'value' => true,
    2727        ],
    28         [
    29             'slug'  => 'on_selection',
    30             'value' => false,
    31         ],
    3228    ];
    3329
  • consistency/tags/1.7.0/includes/MetaData/MetaData.php

    r3122806 r3130518  
    8787
    8888    /**
    89      * Set currentValue from database
     89     * Fetch and set the current value from the database.
     90     *
     91     * This method retrieves the current value from the database using the get() method
     92     * and assigns it to the currentValue property.
    9093     *
    9194     * @return void
    9295     */
    93     public function setCurrentValue(): void
     96    public function fetchAndSetCurrentValue(): void
    9497    {
    9598        $this->currentValue = $this->get();
     
    109112    public function add(): void
    110113    {
    111         $this->setCurrentValue();
     114        $this->fetchAndSetCurrentValue();
    112115
    113116        if ( ! empty( $this->currentValue ) ) {
  • consistency/tags/1.7.0/includes/Option/Option.php

    r2859754 r3130518  
    5454    public function get()
    5555    {
    56         return get_option( $this->optionName );
     56        return get_option( $this->optionName, null );
    5757    }
    5858
     
    6262    public function add(): void
    6363    {
    64         if ( false !== $this->get() ) {
     64        if ( null !== $this->get() ) {
    6565            $this->update( $this->optionName, $this->get(), $this->value );
    6666        }
    6767
    68         if ( false === $this->get() ) {
     68        if ( null === $this->get() ) {
    6969            add_option( $this->optionName, $this->value );
    7070        }
  • consistency/tags/1.7.0/includes/Plugin.php

    r3125834 r3130518  
    55
    66use Webaxones\Consistency\Config\Languages;
     7use Webaxones\Consistency\Config\LocalizationManagement;
    78use Webaxones\Consistency\Config\UserSettings;
    89use Webaxones\Consistency\Config\RestSchema;
     
    3233    protected static function setConstants(): void
    3334    {
    34         defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.6.5' );
     35        defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.7.0' );
    3536        defined( __NAMESPACE__ . '\PLUGIN_URL' ) || define( __NAMESPACE__ . '\PLUGIN_URL', plugin_dir_url( __DIR__ ) );
    3637        defined( __NAMESPACE__ . '\PLUGIN_PATH' ) || define( __NAMESPACE__ . '\PLUGIN_PATH', plugin_dir_path( __DIR__ ) );
    3738        defined( __NAMESPACE__ . '\OPTION_GROUP' ) || define( __NAMESPACE__ . '\OPTION_GROUP', 'consistency_plugin' );
    38         defined( __NAMESPACE__ . '\MAIN_OPTION_NAME' ) || define( __NAMESPACE__ . '\MAIN_OPTION_NAME', 'consistency_plugin_settings' );
     39        defined( __NAMESPACE__ . '\LOCALIZED_RULES_OPTION_NAME' ) || define( __NAMESPACE__ . '\LOCALIZED_RULES_OPTION_NAME', 'consistency_plugin_settings' );
     40        defined( __NAMESPACE__ . '\LOCALIZATION_MANAGEMENT_OPTION_NAME' ) || define( __NAMESPACE__ . '\LOCALIZATION_MANAGEMENT_OPTION_NAME', 'consistency_plugin_localization_management' );
    3941        defined( __NAMESPACE__ . '\USER_SETTINGS_META_KEY' ) || define( __NAMESPACE__ . '\USER_SETTINGS_META_KEY', 'consistency_plugin_user_settings' );
    4042    }
     
    5456        $hooks->register( $assets );
    5557
    56         // Register default global settings in main option depending on language
    57         $languages = new Languages( LocalizedRules::$list );
    58         $option    = new Option( MAIN_OPTION_NAME, $languages );
    59         $hooks->register( $option );
     58        // Register localized rules in options, listing the locales that use each correction depending on the language
     59        $languages      = new Languages( LocalizedRules::$list );
     60        $localizedRules = new Option( LOCALIZED_RULES_OPTION_NAME, $languages );
     61        $hooks->register( $localizedRules );
    6062
    61         // Declare REST Schema for global settings
    62         $setting = new Setting( MAIN_OPTION_NAME, 'array', RestSchema::$globalSetting );
    63         $hooks->register( $setting );
     63        // Declare REST Schema for global rules settings
     64        $ruleSetting = new Setting( LOCALIZED_RULES_OPTION_NAME, 'array', RestSchema::$ruleSettingSchema );
     65        $hooks->register( $ruleSetting );
     66
     67        // Register an option to check if the correction rules are localized or not: if not, the rules are applied to all locales.
     68        // Can be disabled with a filter.
     69        // ie: add_filter( 'Consistency\only_show_locale_correction_rules', '__return_false' );
     70        $localizationManagement = new LocalizationManagement( apply_filters( 'Consistency\only_show_locale_correction_rules', 1 ) );
     71        $localization = new Option( LOCALIZATION_MANAGEMENT_OPTION_NAME, $localizationManagement );
     72        $hooks->register( $localization );
     73
     74        // Declare REST Schema for global localization management settings
     75        $localizationManagementSetting = new Setting( LOCALIZATION_MANAGEMENT_OPTION_NAME, 'boolean', true );
     76        $hooks->register( $localizationManagementSetting );
    6477
    6578        // Get current user
     
    7386
    7487        // Declare REST Schema for user settings
    75         $meta = new Meta( USER_SETTINGS_META_KEY, 'array', RestSchema::$userMeta, 'edit_posts', $currentUser );
     88        $meta = new Meta( USER_SETTINGS_META_KEY, 'array', RestSchema::$userMetaSchema, 'edit_posts', $currentUser );
    7689        $hooks->register( $meta );
    7790
  • consistency/tags/1.7.0/includes/Setting/Setting.php

    r2859754 r3130518  
    8181            'sanitize_callback' => [ $this, 'sanitizeCallback' ],
    8282        ];
     83
    8384        register_setting( $this->optionGroup, $this->optionName, $args );
    8485    }
  • consistency/tags/1.7.0/package.json

    r3125834 r3130518  
    11{
    22    "name": "consistency",
    3     "version": "1.6.5",
     3    "version": "1.7.0",
    44    "description": "",
    55    "main": "index.js",
  • consistency/tags/1.7.0/readme.md

    r3123688 r3130518  
    55Fixes typographic errors when typing in the WordPress editor. 
    66
    7 Do you see the typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.
     7Have you seen the typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.
    88 
    99See [WordPress directory page](https://wordpress.org/plugins/consistency/).
     
    3535## Description
    3636
    37 The purpose of this plugin is to provide a tool allowing administrators to define typographical rules in order to maintain typographical consistency in the text contents entered on the editor. 
     37This WordPress plugin ensures consistent typography on your site.
     38 
    3839> [!IMPORTANT]
    3940> The corrections are automatic and are made during the entry as well as on a copy paste. 
     
    7172
    7273    
     74
     75If your locale is not supported by Consistency but you still want to access all available rules, you can disable the localization of rules via a filter. Add this to your theme's functions.php file:
     76
     77```PHP
     78add_filter( 'Consistency\only_show_locale_correction_rules', '__return_false' );
     79```
     80
     81All correction rules will then appear, with automatic management of rule incompatibilities (if rule A is enabled and it is incompatible with rule B, rule B will be grayed out).
     82
    7383> [!TIP]
    7484> **Ctrl+Z** or **Cmd+Z** right after a correction disables the correction for the next keystroke. It is thus possible to force the non-correction of a character.
  • consistency/tags/1.7.0/readme.txt

    r3125834 r3130518  
    44Requires at least: 6.1
    55Tested up to: 6.6
    6 Stable tag: 1.6.5
     6Stable tag: 1.7.0
    77Requires PHP: 7.4
    88License: GPL-3.0-or-later
     
    1313== Description ==
    1414
    15 Do you see the typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.
     15Have you seen the typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.
    1616
    17 This WordPress plugin is designed to help administrators enforce consistent typography in text content entered in the editor.
     17This WordPress plugin ensures consistent typography on your site.
    1818Corrections are applied automatically both during text entry and when pasting text.
    19 Users can enable or disable autocorrect rules as needed.
     19
     20All users can choose to enable or disable corrections, but only administrators can configure the correction rules.
    2021Autocorrect is available for pages, posts, and custom post types (if they are configured to use the Rest API).
     22The available automatic corrections are listed on [the plugin repository on github](https://github.com/webaxones/consistency/) and are categorized as follows: Apostrophes, Quotation Marks, Dashes, Suffixes, Spaces, Case, Ellipsis, Symbols.
    2123
    22 Automatic fixes are listed on [the plugin repository on github](https://github.com/webaxones/consistency/).
     24Pressing Ctrl+Z or Cmd+Z immediately after a correction disables the correction for the next keystroke.
    2325
     26== Technical Information ==
    2427
    25 
    26 Ctrl+Z or Cmd+Z right after a correction disables the correction for the next keystroke
    27 
    28 Technically, rules are saved in the wp_options table, while active/inactive states are saved as user meta data.
     28**Data Storage**: Rules are saved in the wp_options table, while active/inactive states are saved as user meta data.
    2929This data is deleted when the plugin is uninstalled.
    3030
    31 Settings are directly in a plugin sidebar under the Block Editor: no more searching for an options page, always available and discreet.
     31**Settings Location**: Settings are directly in a plugin sidebar under the Block Editor: no more searching for an options page, always available and discreet.
    3232
    33 The locales supported by this plugin are:
     33**Supported Locales**: The locales supported by this plugin are:
    3434'fr_FR', 'fr_BE', 'en_US', 'en_AU', 'en_CA', 'en_NZ', 'en_ZA', 'en_GB', 'de_DE', 'de_AT', 'de_CH', 'ro_RO'
     35
     36If your locale is not supported by Consistency but you still want to access all available rules, you can disable the localization of rules via a filter. Add this to your theme's functions.php file:
     37`add_filter( 'Consistency\only_show_locale_correction_rules', '__return_false' );`
     38All correction rules will then appear, with automatic management of rule incompatibilities (if rule A is enabled and it is incompatible with rule B, rule B will be grayed out).
    3539
    3640== Screenshots ==
    3741
    38 1. Apostrophes
    39 2. Quotation marks
    40 3. Dashes
    41 4. Suffixes
    42 5. Spaces
    43 6. Case
    44 7. Ellipsis
    45 8. Symbols
     421. Actions Settings: These settings can be seen and modified by all user roles, unlike the following ones relating to correction rules which can only be seen and modified by an administrator role.
     432. Apostrophes
     443. Quotation marks
     454. Dashes
     465. Suffixes
     476. Spaces
     487. Case
     498. Ellipsis
     509. Symbols
    4651
    4752== Installation ==
     
    50552. Configure the rules in the editor.
    5156
     57== Frequently Asked Questions ==
     58
     59= Does this plugin modify my content? =
     60
     61Yes, the saved content will be the one modified by the plugin, but you can see the changes being made in real time and you can choose to accept or reject them.
     62
     63= Will this plugin slow down my page loading time? =
     64
     65Absolutely not, since nothing is done on the front end. The processing only occurs when you enter content.
     66
     67
    5268== Changelog ==
     69
     70= 1.7.0 =
     71* Add: Add the ability to display all correction rules regardless of the current locale with a filter (Consistency\only_show_locale_correction_rules)
     72* Add: Prevents incompatible fixes from being enabled when locale limiting has been disabled by the filter
     73* Add: Update readme
    5374
    5475= 1.6.5 =
     
    7394* Fix: Separate old changelog and new logs in 2 files
    7495
    75 = 1.5.9 =
    76 * Add rule for percentages symbols
    77 * Refactor some code
    78 * Actualise Readme
    79 
    8096See [changelog.txt](https://plugins.svn.wordpress.org/consistency/trunk/changelog.txt) for older changelog
  • consistency/tags/1.7.0/src/app/checks.js

    r3092549 r3130518  
    1818import { processedBlocks } from '../config/processedBlocks'
    1919import { aMemoryLeakHasOccured } from './helpers'
     20import { ruleIncompatibilities } from '../config/ruleIncompatibilities'
     21import { getGlobalSettings } from './data'
    2022
    2123const { getBlockName, getBlockAttributes } = select( 'core/block-editor' )
     
    9698
    9799}
     100
     101/**
     102 * Checks if at least one incompatible rule of the current rule is enabled.
     103 *
     104 * @param {string} currentRule - The current rule to check.
     105 * @returns {boolean} - Returns true if at least one incompatible rule is enabled, otherwise false.
     106 */
     107export const checkRuleCompatibility = currentRule => {
     108
     109    // Get the current rule from the ruleIncompatibilities array
     110    const rule = ruleIncompatibilities.find( rule => rule.slug === currentRule )
     111    if ( ! rule ) return false
     112
     113    // Check if at least one incompatible rule is enabled
     114    return rule.incompatibleWith.some( incompatibleRule => {
     115        // Return the state of the incompatible rule
     116        return getGlobalSettings()?.find( setting => setting.slug === incompatibleRule )?.value
     117    } )
     118
     119}
  • consistency/tags/1.7.0/src/app/data.js

    r3083522 r3130518  
    2424
    2525    return globalSettings
     26
     27}
     28
     29/**
     30 * Retrieves the localization management setting from the site entity.
     31 * @returns {any} The localization management setting.
     32 */
     33export const getLocalizationManagementSetting = () => {
     34   
     35    const siteEntity = getEntityRecord( 'root', 'site' )
     36    const localizationManagementSetting = siteEntity?.consistency_plugin_localization_management
     37
     38    return localizationManagementSetting
    2639
    2740}
  • consistency/tags/1.7.0/src/components/GlobalSettingPanel.js

    r3122806 r3130518  
    1010 */
    1111import { __ } from '@wordpress/i18n'
    12 import { Panel, PanelHeader, PanelBody, PanelRow } from '@wordpress/components'
     12import { Panel, PanelHeader, PanelBody } from '@wordpress/components'
    1313
    1414/**
    1515 * External dependencies
    1616 */
     17import { LocaleLabel } from './LocaleLabel'
    1718import { GlobalSettingToggle } from './GlobalSettingToggle'
    1819import { rules } from '../config/rules'
     
    2425const GlobalSettingPanel = () => (
    2526    <Panel className='GlobalSettingPanel'>
    26         <PanelHeader><strong>{ __( 'Global correction rules', 'consistency' ) }</strong></PanelHeader>
     27        <PanelHeader>
     28            <strong>{ __( 'Global correction rules', 'consistency' ) }<LocaleLabel /></strong>
     29        </PanelHeader>
    2730        {
    2831            [ ...categories ].map( ( cat, key ) => {
  • consistency/tags/1.7.0/src/components/GlobalSettingToggle.js

    r3086094 r3130518  
    1919 */
    2020import { isUsedByLocale } from '../app/checks'
     21import { getLocalizationManagementSetting } from '../app/data'
     22import { checkRuleCompatibility } from '../app/checks'
    2123
    2224export const GlobalSettingToggle = props => {
    2325
    2426    const { settingSlug, settingName, settingDescription } = props
     27    const { createNotice } = useDispatch( noticesStore )
    2528
    26     if ( ! isUsedByLocale( settingSlug ) ) return ''
     29    if ( getLocalizationManagementSetting() && ! isUsedByLocale( settingSlug ) ) return ''
    2730
    2831    const [ settings, setSettings ] = useEntityProp(
     
    3437
    3538    const { saveEditedEntityRecord } = useDispatch( coreStore )
    36     const { createNotice } = useDispatch( noticesStore )
    3739       
    3840    const onSettingChanged = value => {
     
    4446            return obj
    4547        } )
    46 
    47         if ( ! newSettings?.find( x => x.slug === settingSlug ) ) {
    48             newSettings.push( { slug: settingSlug, value: value } )
    49         }
    5048
    5149        setSettings( newSettings )
     
    5957            { isDismissible: true, type: 'snackbar', speak: true }
    6058        )
     59
    6160    }
    6261
     
    6766                help={ ( <span dangerouslySetInnerHTML={ settingDescription } /> ) }
    6867                checked={ settings?.find( x => x.slug === settingSlug )?.value || false }
     68                disabled={ checkRuleCompatibility( settingSlug ) }
    6969                onChange={ onSettingChanged }
    7070            />
  • consistency/tags/1.7.0/src/components/UserSettingPanel.js

    r3122806 r3130518  
    2222const UserSettingPanel = () => (
    2323    <Panel className='UserSettingPanel'>
    24         <PanelHeader><strong>{ __( 'Settings for my account', 'consistency' ) }</strong></PanelHeader>
     24        <PanelHeader><strong>{ __( 'Settings for my account', 'consistency' ) }</strong><br/></PanelHeader>
    2525        <div style={{ padding: 16 }}>
    2626            <PanelRow>
  • consistency/tags/1.7.0/src/config/rules.js

    r3122806 r3130518  
    1313export const rules = [
    1414    {
    15         // Replaces straight quote with curly quote
     15        // Replaces straight apostrophes with curly apostrophes
    1616        slug: 'quote', // slug of the setting and the related regex
    17         name: __( 'Straight quote', 'consistency' ), // name of the setting
    18         description: __( 'Replaces straight quotes with curved quotes:', 'consistency' )
     17        name: __( 'Straight Apostrophe', 'consistency' ), // name of the setting
     18        description: __( 'Replace straight apostrophes with curly apostrophes:', 'consistency' )
    1919            + `<span aria-hidden='true' style='display:block;'><code>'</code> <span style='font-size:20px'>→</span> <code>’</code></span>`, // description of the setting
    2020        mask: /\'/, // mask
     
    2424    },
    2525    {
    26         // Replaces two hyphens with En dash
     26        // Replaces two hyphens with an En dash
    2727        slug: '2hyphens',
    28         name: __( 'En dash', 'consistency' ),
    29         description: __( 'Replaces 2 hyphens with En dash:', 'consistency' )
     28        name: __( 'En Dash', 'consistency' ),
     29        description: __( 'Replace two hyphens with an en dash:', 'consistency' )
    3030            + `<span aria-hidden='true' style='display:block;'><code>--</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">–</code></span>`,
    3131        mask: /(?:\-)\-/,
     
    3737        // Replaces three hyphens with Em dash
    3838        slug: '3hyphens',
    39         name: __( 'Em dash', 'consistency' ),
    40         description: __( 'Replaces 3 hyphens with Em dash:', 'consistency' )
     39        name: __( 'Em Dash', 'consistency' ),
     40        description: __( 'Replace three hyphens with an em dash:', 'consistency' )
    4141            + `<span aria-hidden='true' style='display:block;'><code>---</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">—</code></span>`,
    4242        mask: /(?:\–|\-\-)\-/,
     
    4949    },
    5050    {
    51         // Replaces four hyphens with Two-Em dash
     51        // Replaces four hyphens with two-em dash
    5252        slug: '4hyphens',
    53         name: __( 'Two-Em dash', 'consistency' ),
    54         description: __( 'Replaces 4 hyphens with Two-Em dash:', 'consistency' )
     53        name: __( 'Two-Em Dash', 'consistency' ),
     54        description: __( 'Replace four hyphens with two-em dash:', 'consistency' )
    5555            + `<span aria-hidden='true' style='display:block;'><code>----</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">⸺</code></span>`,
    5656        mask: /(?:\—|\–\-|\-\-\-)\-/,
     
    6363    },
    6464    {
    65         // Adds HTML tag sup to ordinal number suffix
     65        // Add the sup HTML tag to ordinal number suffixes
    6666        slug: 'ordinalNumberSuffix',
    67         name: __( 'Ordinal number suffix', 'consistency' ),
    68         description: __( 'Add HTML tag sup to ordinal number suffix', 'consistency' )
     67        name: __( 'Ordinal Number Suffix', 'consistency' ),
     68        description: __( 'Add the sup HTML tag to ordinal number suffixes', 'consistency' )
    6969        + `<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>`,
    7070        mask: /([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/,
     
    7474    },
    7575    {
    76         // Replaces regular quotes with curly quotes
     76        // Replaces straight quotes with curly quotes
    7777        slug: 'regularToCurlyQuotes',
    78         name: __( 'Curly quotes', 'consistency' ),
    79         description: __( 'Replaces regular quotes with curly quotes:', 'consistency' )
     78        name: __( 'Curly Quotes', 'consistency' ),
     79        description: __( 'Replace straight quotes with curly quotes:', 'consistency' )
    8080            + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>“ ”</code></span>`,
    8181        mask: /"/, // specific mask with specific process
     
    8585    },
    8686    {
    87         // Replaces regular quotes with german quotes
     87        // Replaces straight quotes with german quotes
    8888        slug: 'regularToGermanQuotes',
    89         name: __( 'Regular quotes to german', 'consistency' ),
    90         description: __( 'Replaces regular quotes with german quotes:', 'consistency' )
     89        name: __( 'German Quotes', 'consistency' ),
     90        description: __( 'Replace straight quotes with german quotes:', 'consistency' )
    9191        + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>„ “</code></span>`,
    9292        mask: /"/, // specific mask with specific process
     
    9696    },
    9797    {
    98         // Replaces regular quotes with german book-style quotes
     98        // Replaces straight quotes with german book-style quotes
    9999        slug: 'regularToGermanBookStyleQuotes',
    100         name: __( 'Regular quotes to german book-style quotes', 'consistency' ),
    101         description: __( 'Replaces regular quotes with german book-style quotes:', 'consistency' )
     100        name: __( 'German Book-Style Quotes', 'consistency' ),
     101        description: __( 'Replace straight quotes with german book-style quotes:', 'consistency' )
    102102            + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>» «</code></span>`,
    103103        mask: /"/, // specific mask with specific process
     
    107107    },
    108108    {
    109         // Replaces regular quotes with french quotes
     109        // Replaces straight quotes with french quotes
    110110        slug: 'regularToFrenchQuotes',
    111         name: __( 'Regular quotes to french', 'consistency' ),
    112         description: __( 'Replaces regular quotes with french quotes:', 'consistency' )
     111        name: __( 'French Quotes with Spaces', 'consistency' ),
     112        description: __( 'Replace straight quotes with french quotes with non-breaking spaces:', 'consistency' )
    113113            + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>`,
    114114        mask: /"/, // specific mask with specific process
     
    120120        // Replaces regular quotes with french quotes without spaces
    121121        slug: 'regularToFrenchQuotesWithoutSpaces',
    122         name: __( 'Regular quotes to french quotes without spaces', 'consistency' ),
    123         description: __( 'Replaces regular quotes with french quotes without spaces:', 'consistency' )
     122        name: __( 'French Quotes', 'consistency' ),
     123        description: __( 'Replace straight quotes with french quotes without spaces:', 'consistency' )
    124124            + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>« »</code></span>`,
    125125        mask: /"/, // specific mask with specific process
     
    131131        // Replaces curly quotes with french quotes
    132132        slug: 'curlyToFrenchQuotes',
    133         name: __( 'Curly quotes to french quotes', 'consistency' ),
    134         description: __( 'Replaces curly quotes with french quotes:', 'consistency' )
     133        name: __( 'Curly Quotes to French Quotes', 'consistency' ),
     134        description: __( 'Replace curly quotes with french quotes with non-breaking spaces:', 'consistency' )
    135135            + `<span aria-hidden='true' style='display:block;'><code>“ ”</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>`,
    136136        mask: /“.*?”/, // specific mask with specific process
     
    142142        // Replaces a breaking space followed by a character from this list [? ! : ; » € $ £ ¥ ₽ 元 %] with a non-breaking space
    143143        slug: 'breakingSpace',
    144         name: __( 'Breaking space', 'consistency' ),
    145         description: sprintf( __( 'Replaces a breaking space followed by a character from this list:%1$s with a non-breaking space', 'consistency' )
     144        name: __( 'Breaking Spaces', 'consistency' ),
     145        description: sprintf( __( 'Replace a breaking space followed by a character from this list:%1$s with a non-breaking space', 'consistency' )
    146146            , `<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />` ),
    147147        mask: / ([\?|\!|\:|\;|\»|\€|\$|\£|\¥|\₽|\元|\%])/,
     
    153153        // Adds a non-breaking space before a character from this list [? ! : ; » € $ £ ¥ ₽ 元 %] having no space before
    154154        slug: 'noSpaceBefore',
    155         name: __( 'No space before', 'consistency' ),
    156         description: sprintf( __( 'Adds a non-breaking space before a character from this list:%1$s having no space before', 'consistency' )
     155        name: __( 'No Space Before', 'consistency' ),
     156        description: sprintf( __( 'Add a non-breaking space before a character from this list:%1$s having no space before', 'consistency' )
    157157            , `<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />` ),
    158158        mask: /(?<! | |&nbsp;)([\?|\!|\:|\»|\€|\$|\£|\¥|\₽|\元|\%])/,
     
    164164        // Removes any space preceding a character from this list [? ! : ; %]
    165165        slug: 'spaceBefore',
    166         name: __( 'Space before', 'consistency' ),
     166        name: __( 'Space Before', 'consistency' ),
    167167        description: __( 'Remove any space preceding a character from this list:', 'consistency' )
    168168            + `<span style='display:block;'><code>? ! : ; %</code></span>`,
     
    175175        // Adds a breaking space after a character from this list [, … ) ]] if this character is followed with another character except [, .] and a number
    176176        slug: 'noBreakingSpaceAfter',
    177         name: __( 'No breaking space after', 'consistency' ),
    178         description: sprintf( __( 'Adds a breaking space after a character from this list:%1$s when followed with another character', 'consistency' )
     177        name: __( 'No Breaking Space After', 'consistency' ),
     178        description: sprintf( __( 'Add a breaking space after a character from this list:%1$s when followed with another character', 'consistency' )
    179179            , `<br /><code>, … ) ]</code><br />` ),
    180180        mask: /([\,|\…|\)|\]])(?! | |\.|\,|\d|$)(.)/,
     
    186186        // Adds a non-breaking space after [«] having no space after
    187187        slug: 'noNonBreakingSpaceAfter',
    188         name: __( 'No non breaking space after', 'consistency' ),
    189         description: __( 'Adds a non-breaking space after open french quote having no space after', 'consistency' ),
     188        name: __( 'No Non-Breaking Space After', 'consistency' ),
     189        description: __( 'Add a non-breaking space after open french quote having no space after', 'consistency' ),
    190190        mask: /(«)(?! | |&nbsp;)/,
    191191        replace: '$1 ',
     
    196196        // Capitalize the first letter of a sentence
    197197        slug: 'capitalizeFirstSentenceLetter',
    198         name: __( 'First sentence letter not capitalized', 'consistency' ),
     198        name: __( 'First Sentence Letter', 'consistency' ),
    199199        description: __( 'Capitalize the first letter of a sentence', 'consistency' ),
    200200        mask: /(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|\…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/,
     
    206206        // Replaces etc... with etc.
    207207        slug: 'etcThreeDots',
    208         name: __( '3 dots following "etc"', 'consistency' ),
    209         description: __( 'Replaces 3 dots placed after the abbreviation "etc" with a point:', 'consistency' )
     208        name: __( 'Three Dots Following "etc"', 'consistency' ),
     209        description: __( 'Replace 3 dots placed after the abbreviation "etc" with a period:', 'consistency' )
    210210        + `<span aria-hidden='true' style='display:block;'><code>etc...</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`,
    211211        mask: /etc(\.{3})/i,
     
    217217        // Replaces etc.. with etc.
    218218        slug: 'etcTwoDots',
    219         name: __( '2 dots following "etc"', 'consistency' ),
    220         description: __( 'Replaces 2 dots placed after the abbreviation "etc" with a point:', 'consistency' )
     219        name: __( 'Two Dots Following "etc"', 'consistency' ),
     220        description: __( 'Replace 2 dots placed after the abbreviation "etc" with a period:', 'consistency' )
    221221        + `<span aria-hidden='true' style='display:block;'><code>etc..</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`,
    222222        mask: /etc(\.{2})/i,
     
    228228        // Replaces etc… with etc.
    229229        slug: 'etcEllipsis',
    230         name: __( 'Ellipsis following "etc"', 'consistency' ),
    231         description: __( 'Replaces ellipsis placed after the abbreviation "etc" with a point:', 'consistency' )
     230        name: __( 'Ellipsis Following "etc"', 'consistency' ),
     231        description: __( 'Replace the ellipsis placed after the abbreviation "etc" with a period:', 'consistency' )
    232232        + `<span aria-hidden='true' style='display:block;'><code>etc…</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`,
    233233        mask: /etc(\.{3}|…)/i,
     
    250250        // Replaces a character from this list [c p r] when enclosed in parentheses with a symbol
    251251        slug: 'symbolInACircle',
    252         name: __( 'Symbol in a circle', 'consistency' ),
     252        name: __( 'Symbol in a Circle', 'consistency' ),
    253253        description: __( 'Replaces 1 character placed in parentheses with a symbol', 'consistency' )
    254254            + `<span aria-hidden='true' style='display:block;'><code>(c) (p) (r)</code> <span style='font-size:20px'>→</span> <code>© ℗ ®</code></span>`,
     
    271271        // Replaces a character from this list [md tm mc sm] with a symbol in small caps and superscript style
    272272        slug: 'symbolInSmallCapsAndSuperscriptStyle',
    273         name: __( 'Symbol in small caps and superscript style', 'consistency' ),
     273        name: __( 'Symbol in Small Caps and Superscript Style', 'consistency' ),
    274274        description: __( 'Replaces 2-character abbreviations with a symbol in small caps and superscript style', 'consistency' )
    275275        + `<span aria-hidden='true' style='display:block;'><code>tm sm md mc</code> <span style='font-size:20px'>→</span> <code>™ ℠ 🅫 🅪</code></span>`,
  • consistency/trunk/build/index.asset.php

    r3122806 r3130518  
    1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-i18n', 'wp-notices', 'wp-plugins'), 'version' => 'bcd6cb4e252b3d42baa6');
     1<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-i18n', 'wp-notices', 'wp-plugins'), 'version' => 'eccd1fcee4002381057b');
  • consistency/trunk/build/index.js

    r3122806 r3130518  
    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]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const t=window.wp.plugins,s=window.wp.data,n=window.wp.domReady;var o=e.n(n);const c=window.React,a=window.wp.i18n,r=window.wp.editPost,i=window.wp.components,l=()=>(0,c.createElement)(i.Icon,{icon:(0,c.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,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"4",y1:"20",x2:"7",y2:"20"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"14",y1:"20",x2:"21",y2:"20"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,c.createElement)("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:"5,20 11,4 13,4 20,20 "}))}),d=window.wp.coreData,p=window.wp.notices,u=e=>{const{settingSlug:t,settingName:n,settingDescription:o}=e,{currentUser:r}=(0,s.useSelect)((e=>({currentUser:e(d.store).getCurrentUser()})),[]),l=r&&r.id,[u,g]=(0,d.useEntityProp)("root","user","meta",l),{saveEditedEntityRecord:y}=(0,s.useDispatch)(d.store),{createNotice:m}=(0,s.useDispatch)(p.store);return(0,c.createElement)(i.ToggleControl,{label:n,help:(0,c.createElement)("span",{dangerouslySetInnerHTML:o}),checked:u?.consistency_plugin_user_settings?.find((e=>e.slug===t))?.value||!1,onChange:e=>{let s=u?.consistency_plugin_user_settings.map((s=>t===s.slug?{...s,value:e}:s));s?.find((e=>e.slug===t))||s.push({slug:t,value:e}),g({...u,consistency_plugin_user_settings:s}),y("root","user",l,{...u,meta:s}),m((0,a.__)("info","consistency"),e?sprintf((0,a.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,a.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}})},g=()=>(0,c.createElement)(i.Panel,{className:"UserSettingPanel"},(0,c.createElement)(i.PanelHeader,null,(0,c.createElement)("strong",null,(0,a.__)("Settings for my account","consistency"))),(0,c.createElement)("div",{style:{padding:16}},(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(u,{settingSlug:"on_the_fly",settingName:(0,a.__)("On-the-fly autocorrect","consistency"),settingDescription:{__html:(0,a.__)("Enable/disable on-the-fly autocorrect","consistency")}})),(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(u,{settingSlug:"on_paste",settingName:(0,a.__)("On paste autocorrect","consistency"),settingDescription:{__html:(0,a.__)("Enable/disable autocorrect on paste","consistency")}})))),{getEntityRecord:y}=(0,s.select)("core"),m=["regularToCurlyQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces","regularToGermanQuotes","regularToGermanBookStyleQuotes"],_=["core/paragraph","core/heading","core/quote","core/list-item","core/read-more"],{getBlock:h}=(0,s.select)("core/block-editor"),{updateBlock:b}=(0,s.dispatch)("core/block-editor"),{getBlockName:f,getBlockAttributes:k}=(0,s.select)("core/block-editor"),v=e=>{const t=(()=>{const e=y("root","site");return e?.language||"en_US"})();return!(void 0===localesByRules||!localesByRules.hasOwnProperty(e))&&localesByRules[e].includes(t)},w=e=>{const{settingSlug:t,settingName:n,settingDescription:o}=e;if(!v(t))return"";const[r,l]=(0,d.useEntityProp)("root","site","consistency_plugin_settings",void 0),{saveEditedEntityRecord:u}=(0,s.useDispatch)(d.store),{createNotice:g}=(0,s.useDispatch)(p.store);return(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(i.ToggleControl,{label:n,help:(0,c.createElement)("span",{dangerouslySetInnerHTML:o}),checked:r?.find((e=>e.slug===t))?.value||!1,onChange:e=>{let s=r.map((s=>t===s.slug?{...s,value:e}:s));s?.find((e=>e.slug===t))||s.push({slug:t,value:e}),l(s),u("root","site",void 0,s),g((0,a.__)("info","consistency"),e?sprintf((0,a.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,a.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}}))},E=[{slug:"quote",name:(0,a.__)("Straight quote","consistency"),description:(0,a.__)("Replaces straight quotes with curved quotes:","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,a.__)("En dash","consistency"),description:(0,a.__)("Replaces 2 hyphens with 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,a.__)("Em dash","consistency"),description:(0,a.__)("Replaces 3 hyphens with 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,a.__)("Two-Em dash","consistency"),description:(0,a.__)("Replaces 4 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,a.__)("Ordinal number suffix","consistency"),description:(0,a.__)("Add HTML tag sup to ordinal number suffix","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,a.__)("Curly quotes","consistency"),description:(0,a.__)("Replaces regular 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,a.__)("Regular quotes to german","consistency"),description:(0,a.__)("Replaces regular 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,a.__)("Regular quotes to german book-style quotes","consistency"),description:(0,a.__)("Replaces regular 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,a.__)("Regular quotes to french","consistency"),description:(0,a.__)("Replaces regular quotes with french quotes:","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,a.__)("Regular quotes to french quotes without spaces","consistency"),description:(0,a.__)("Replaces regular 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,a.__)("Curly quotes to french quotes","consistency"),description:(0,a.__)("Replaces curly quotes with french quotes:","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,a.__)("Breaking space","consistency"),description:sprintf((0,a.__)("Replaces 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,a.__)("No space before","consistency"),description:sprintf((0,a.__)("Adds 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,a.__)("Space before","consistency"),description:(0,a.__)("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,a.__)("No breaking space after","consistency"),description:sprintf((0,a.__)("Adds 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,a.__)("No non breaking space after","consistency"),description:(0,a.__)("Adds 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,a.__)("First sentence letter not capitalized","consistency"),description:(0,a.__)("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,a.__)('3 dots following "etc"',"consistency"),description:(0,a.__)('Replaces 3 dots placed after the abbreviation "etc" with a point:',"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,a.__)('2 dots following "etc"',"consistency"),description:(0,a.__)('Replaces 2 dots placed after the abbreviation "etc" with a point:',"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,a.__)('Ellipsis following "etc"',"consistency"),description:(0,a.__)('Replaces ellipsis placed after the abbreviation "etc" with a point:',"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,a.__)("Ellipsis","consistency"),description:(0,a.__)("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,a.__)("Symbol in a circle","consistency"),description:(0,a.__)("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,a.__)("Symbol in small caps and superscript style","consistency"),description:(0,a.__)("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,a.__)("Fractions","consistency"),description:(0,a.__)("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,a.__)("Percentages","consistency"),description:(0,a.__)("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"}],x=[{slug:"apostrophe",label:(0,a.__)("Apostrophes","consistency"),description:(0,a.__)("Fixes related to apostrophes.","consistency")},{slug:"quotation",label:(0,a.__)("Quotation marks","consistency"),description:(0,a.__)("Fixes related to quotation marks.","consistency")},{slug:"dash",label:(0,a.__)("Dashes","consistency"),description:(0,a.__)("Fixes related to dashes.","consistency")},{slug:"suffixe",label:(0,a.__)("Suffixes","consistency"),description:(0,a.__)("Fixes related to suffixes.","consistency")},{slug:"space",label:(0,a.__)("Spaces","consistency"),description:(0,a.__)("Fixes related to spaces.","consistency")},{slug:"case",label:(0,a.__)("Case","consistency"),description:(0,a.__)("Fixes related to case.","consistency")},{slug:"ellipsis",label:(0,a.__)("Ellipsis","consistency"),description:(0,a.__)("Fixes related to ellipsis.","consistency")},{slug:"symbol",label:(0,a.__)("Symbols","consistency"),description:(0,a.__)("Fixes related to symbols.","consistency")}],S=()=>(0,c.createElement)(i.Panel,{className:"GlobalSettingPanel"},(0,c.createElement)(i.PanelHeader,null,(0,c.createElement)("strong",null,(0,a.__)("Global correction rules","consistency"))),[...x].map(((e,t)=>(0,c.createElement)(i.PanelBody,{key:t,title:(0,a.__)(e.label,"consistency"),initialOpen:!1},[...E].filter((t=>t.category===e.slug)).map(((e,t)=>(0,c.createElement)(w,{key:t,settingSlug:e.slug,settingName:e.name,settingDescription:{__html:e.description}}))))))),{canUser:C}=(0,s.select)("core"),{getBlock:R,getBlocks:q,getBlockAttributes:P,getSelectionStart:M,isTyping:$}=(0,s.select)("core/block-editor"),{updateBlock:T,selectionChange:F,updateBlockAttributes:B}=(0,s.dispatch)("core/block-editor"),z=t=>{const{currentBlockId:s,isPasting:n,settings:o}=t;let c=E.filter((e=>!0===o?.find((t=>t.slug===e.slug))?.value));const a=R(s);if(!(e=>{const t=f(e);return!!_.includes(t)})(s)||!(e=>{const t=k(e);return!(!t||!t.hasOwnProperty("content")||""===t.content)})(s))return;let r=P(s),i=!1;Object.entries(c).forEach((([t,o])=>{if(!v(o.slug)||i)return;e.g.consistencyLoop++,(t=>{e.g.consistencyLoop>=100&&(t=>{const s=h(t);b(t,{...s,attributes:{...s.attributes,content:s.attributes.content.slice(-2)}}),e.g.consistency_loop=0,console.log("Consistency - a memory leak has occured during the fix of the following block:",s)})(t)})(s);let c,l=o.replace,d="",p="",u=0,g=r.content,y=(e=>e.replace(/<\b(code|pre|kbd)\b>.*?<\/\b(code|pre|kbd)\b>/gi,"").replace(/(<([^>]+)>)/gi,""))(g),_=!1;if($()||(_=o.mask.test(y)),$()){c=M(a.name),u=c?.offset||0;const e=(e=>{const t=document.querySelector(`#block-${e}`);if(null===t)return;const s=document.getSelection(),n=s?.getRangeAt(0);if(!n.collapsed)return;const o=n.cloneRange(),c=document.createTextNode("\0");o.insertNode(c);let a=t?.innerHTML?.indexOf("\0");c.parentNode.removeChild(c),t.normalize();const r=(t?.innerHTML.match(/&nbsp;/g)||[]).length;return r>0&&(a=a-6*r+r),a})(s)||u,t=y.match(o.mask);if(null===t||0===t.length)return;const n=t[0].length||1;d=g.substring(0,e-n),p=g.substring(e-n,g.length),_=o.mask.test(y)&&o.mask.test(p)}if(!_)return;if((e=>!!m.includes(e.slug))(o)&&(l=((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 a="";0!==[...e.replace.matchAll(/[0-9]/g)].length&&(a=e.replace.substring([...e.replace.matchAll(/[0-9]/g)].pop().index+1,e.replace.length-1));const r=new RegExp(`${n}`,"g"),i=new RegExp(`${o}`,"g");return(t.match(r)||[]).length===(t.match(i)||[]).length?n+c:a+o})(o,g)),0!==u&&(g=d+p.replace(o.mask,l)),0===u&&(g=g.replace(o.mask,o.replace)),e.g.previousFixCanceled)return void(e.g.previousFixCanceled=!1);if(e.g.previousFixCanceled||(T(s,{...a,attributes:{...a.attributes,content:g}}),i=!0),0===u||n)return;const f="function"==typeof o.nbMoved?o.nbMoved(p):o.nbMoved;f<0&&F(s,c.attributeKey,u+f,u+f),f>0&&F(s,c.attributeKey,u+1+f,u+f),0===f&&F(s,c.attributeKey,u,u)})),e.g.consistencyLoop=0},{getSelectedBlockClientId:A,isTyping:I,getBlockAttributes:L}=(0,s.select)("core/block-editor");(0,t.registerPlugin)("consistency-custom-sidebar",{render:()=>{const e=C("create","users");return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.PluginSidebar,{name:"consistency-custom-sidebar",title:(0,a.__)("Consistency","consistency"),icon:l},(0,c.createElement)(g,null),e&&(0,c.createElement)(S,null)),(0,c.createElement)(r.PluginSidebarMoreMenuItem,{target:"consistency-custom-sidebar"},(0,a.__)("Consistency Settings","consistency")))}}),o()((()=>{e.g.consistencyLoop=0,e.g.previousFixCanceledContent="",e.g.previousFixCanceled=!1,e.g.contentPasted=!1,e.g.isPasteEventAttached=!1,e.g.isEditorInIframe=null!==document.querySelector('iframe[name="editor-canvas"]'),document.querySelector("#editor")?.addEventListener("keydown",(t=>{90===t.keyCode&&(t.ctrlKey||t.metaKey)&&(e.g.previousFixCanceled=!0,t.preventDefault())})),(0,s.subscribe)((()=>{(()=>{if((()=>{const t=null!==document.querySelector('iframe[name="editor-canvas"]');e.g.isEditorInIframe!==t&&(e.g.isEditorInIframe=t,e.g.isPasteEventAttached=!1)})(),!e.g.isPasteEventAttached){if(e.g.isEditorInIframe){const t=document.querySelector('iframe[name="editor-canvas"]');t&&(t.onload=()=>{(t.contentDocument||t.contentWindow.document).addEventListener("paste",(t=>{e.g.contentPasted=!0,e.g.isPasteEventAttached=!0}))},"complete"===t.contentWindow.document.readyState&&t.onload())}e.g.isEditorInIframe||document.querySelector("#editor")?.addEventListener("paste",(t=>{e.g.contentPasted=!0,e.g.isPasteEventAttached=!0}))}})();const{onTheFly:t,onPaste:n}=(()=>{const e={onTheFly:!1,onPaste:!1},t=(0,s.select)(d.store).getCurrentUser(),n=y("root","user",t?.id||0,"consistency_plugin_user_settings"),o=n?.meta?.consistency_plugin_user_settings;return e.onTheFly=o?.find((e=>"on_the_fly"===e.slug))?.value||!1,e.onPaste=o?.find((e=>"on_paste"===e.slug))?.value||!1,e})();if(!t&&!n)return;const o=(()=>{const e=y("root","site"),t=e?.consistency_plugin_settings;return t})();if(void 0===o)return;if(e.g.contentPasted&&n)return void(t=>{const{settings:s}=t;let n=E.filter((e=>!0===s?.find((t=>t.slug===e.slug))?.value));const o=q(),c=o.flatMap((({innerBlocks:e,...t})=>e.map((e=>({...t,...e}))))),a=o.reduce(((e,t)=>{let s=t.attributes?.content;return _.includes(t.name)&&void 0!==s?(Object.entries(n).forEach((([e,t])=>{if(v(t.slug)){if(m.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(!m.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(a).length>0&&e.g.contentPasted&&(e.g.contentPasted=!1,B(Object.keys(a),a,!0)),e.g.contentPasted=!1,c.forEach((e=>{if(!_.includes(e.name))return;const t=e.clientId;e?.clientId&&z({currentBlockId:t,theRegs:n,isPasting:!0})}))})({settings:o});const c=A();if(null===c||e.g.contentPasted||!t)return;const a=L(c);a.hasOwnProperty("content")&&e.g.previousFixCanceledContent===a.content||(e.g.previousFixCanceledContent=a.content,I()&&z({currentBlockId:c,isPasting:!1,settings:o}))}))}))})();
     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]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const t=window.wp.plugins,s=window.wp.data,n=window.wp.domReady;var o=e.n(n);const c=window.React,a=window.wp.i18n,r=window.wp.editPost,i=window.wp.components,l=()=>(0,c.createElement)(i.Icon,{icon:(0,c.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,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"4",y1:"20",x2:"7",y2:"20"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"14",y1:"20",x2:"21",y2:"20"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,c.createElement)("line",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,c.createElement)("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:"5,20 11,4 13,4 20,20 "}))}),u=window.wp.coreData,p=window.wp.notices,d=e=>{const{settingSlug:t,settingName:n,settingDescription:o}=e,{currentUser:r}=(0,s.useSelect)((e=>({currentUser:e(u.store).getCurrentUser()})),[]),l=r&&r.id,[d,g]=(0,u.useEntityProp)("root","user","meta",l),{saveEditedEntityRecord:y}=(0,s.useDispatch)(u.store),{createNotice:m}=(0,s.useDispatch)(p.store);return(0,c.createElement)(i.ToggleControl,{label:n,help:(0,c.createElement)("span",{dangerouslySetInnerHTML:o}),checked:d?.consistency_plugin_user_settings?.find((e=>e.slug===t))?.value||!1,onChange:e=>{let s=d?.consistency_plugin_user_settings.map((s=>t===s.slug?{...s,value:e}:s));s?.find((e=>e.slug===t))||s.push({slug:t,value:e}),g({...d,consistency_plugin_user_settings:s}),y("root","user",l,{...d,meta:s}),m((0,a.__)("info","consistency"),e?sprintf((0,a.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,a.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}})},g=()=>(0,c.createElement)(i.Panel,{className:"UserSettingPanel"},(0,c.createElement)(i.PanelHeader,null,(0,c.createElement)("strong",null,(0,a.__)("Settings for my account","consistency")),(0,c.createElement)("br",null)),(0,c.createElement)("div",{style:{padding:16}},(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(d,{settingSlug:"on_the_fly",settingName:(0,a.__)("On-the-fly autocorrect","consistency"),settingDescription:{__html:(0,a.__)("Enable/disable on-the-fly autocorrect","consistency")}})),(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(d,{settingSlug:"on_paste",settingName:(0,a.__)("On paste autocorrect","consistency"),settingDescription:{__html:(0,a.__)("Enable/disable autocorrect on paste","consistency")}})))),{getEntityRecord:y}=(0,s.select)("core"),m=()=>{const e=y("root","site"),t=e?.consistency_plugin_settings;return t},h=()=>{const e=y("root","site"),t=e?.consistency_plugin_localization_management;return t},b=()=>{const e=y("root","site");return e?.language||"en_US"},_=()=>{const e=b(),t=h()?(0,a.__)(` (${e} locale)`,"consistency"):(0,a.__)(" (all locales)","consistency");return(0,c.createElement)("span",{style:{fontWeight:"normal",fontStyle:"italic",fontSize:"smaller"}},t)},f=["regularToCurlyQuotes","regularToFrenchQuotes","regularToFrenchQuotesWithoutSpaces","regularToGermanQuotes","regularToGermanBookStyleQuotes"],k=["core/paragraph","core/heading","core/quote","core/list-item","core/read-more"],{getBlock:w}=(0,s.select)("core/block-editor"),{updateBlock:v}=(0,s.dispatch)("core/block-editor"),S=[{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:[]}],{getBlockName:E,getBlockAttributes:x}=(0,s.select)("core/block-editor"),T=e=>{const t=b();return!(void 0===localesByRules||!localesByRules.hasOwnProperty(e))&&localesByRules[e].includes(t)},C=e=>{const t=S.find((t=>t.slug===e));return!!t&&t.incompatibleWith.some((e=>m()?.find((t=>t.slug===e))?.value))},F=e=>{const{settingSlug:t,settingName:n,settingDescription:o}=e,{createNotice:r}=(0,s.useDispatch)(p.store);if(h()&&!T(t))return"";const[l,d]=(0,u.useEntityProp)("root","site","consistency_plugin_settings",void 0),{saveEditedEntityRecord:g}=(0,s.useDispatch)(u.store);return(0,c.createElement)(i.PanelRow,null,(0,c.createElement)(i.ToggleControl,{label:n,help:(0,c.createElement)("span",{dangerouslySetInnerHTML:o}),checked:l?.find((e=>e.slug===t))?.value||!1,disabled:C(t),onChange:e=>{let s=l.map((s=>t===s.slug?{...s,value:e}:s));d(s),g("root","site",void 0,s),r((0,a.__)("info","consistency"),e?sprintf((0,a.__)('"%1$s" Correction is enabled',"consistency"),n):sprintf((0,a.__)('"%1$s" Correction is disabled',"consistency"),n),{isDismissible:!0,type:"snackbar",speak:!0})}}))},Q=[{slug:"quote",name:(0,a.__)("Straight Apostrophe","consistency"),description:(0,a.__)("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,a.__)("En Dash","consistency"),description:(0,a.__)("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,a.__)("Em Dash","consistency"),description:(0,a.__)("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,a.__)("Two-Em Dash","consistency"),description:(0,a.__)("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,a.__)("Ordinal Number Suffix","consistency"),description:(0,a.__)("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,a.__)("Curly Quotes","consistency"),description:(0,a.__)("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,a.__)("German Quotes","consistency"),description:(0,a.__)("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,a.__)("German Book-Style Quotes","consistency"),description:(0,a.__)("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,a.__)("French Quotes with Spaces","consistency"),description:(0,a.__)("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,a.__)("French Quotes","consistency"),description:(0,a.__)("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,a.__)("Curly Quotes to French Quotes","consistency"),description:(0,a.__)("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,a.__)("Breaking Spaces","consistency"),description:sprintf((0,a.__)("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,a.__)("No Space Before","consistency"),description:sprintf((0,a.__)("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,a.__)("Space Before","consistency"),description:(0,a.__)("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,a.__)("No Breaking Space After","consistency"),description:sprintf((0,a.__)("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,a.__)("No Non-Breaking Space After","consistency"),description:(0,a.__)("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,a.__)("First Sentence Letter","consistency"),description:(0,a.__)("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,a.__)('Three Dots Following "etc"',"consistency"),description:(0,a.__)('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,a.__)('Two Dots Following "etc"',"consistency"),description:(0,a.__)('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,a.__)('Ellipsis Following "etc"',"consistency"),description:(0,a.__)('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,a.__)("Ellipsis","consistency"),description:(0,a.__)("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,a.__)("Symbol in a Circle","consistency"),description:(0,a.__)("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,a.__)("Symbol in Small Caps and Superscript Style","consistency"),description:(0,a.__)("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,a.__)("Fractions","consistency"),description:(0,a.__)("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,a.__)("Percentages","consistency"),description:(0,a.__)("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"}],B=[{slug:"apostrophe",label:(0,a.__)("Apostrophes","consistency"),description:(0,a.__)("Fixes related to apostrophes.","consistency")},{slug:"quotation",label:(0,a.__)("Quotation marks","consistency"),description:(0,a.__)("Fixes related to quotation marks.","consistency")},{slug:"dash",label:(0,a.__)("Dashes","consistency"),description:(0,a.__)("Fixes related to dashes.","consistency")},{slug:"suffixe",label:(0,a.__)("Suffixes","consistency"),description:(0,a.__)("Fixes related to suffixes.","consistency")},{slug:"space",label:(0,a.__)("Spaces","consistency"),description:(0,a.__)("Fixes related to spaces.","consistency")},{slug:"case",label:(0,a.__)("Case","consistency"),description:(0,a.__)("Fixes related to case.","consistency")},{slug:"ellipsis",label:(0,a.__)("Ellipsis","consistency"),description:(0,a.__)("Fixes related to ellipsis.","consistency")},{slug:"symbol",label:(0,a.__)("Symbols","consistency"),description:(0,a.__)("Fixes related to symbols.","consistency")}],P=()=>(0,c.createElement)(i.Panel,{className:"GlobalSettingPanel"},(0,c.createElement)(i.PanelHeader,null,(0,c.createElement)("strong",null,(0,a.__)("Global correction rules","consistency"),(0,c.createElement)(_,null))),[...B].map(((e,t)=>(0,c.createElement)(i.PanelBody,{key:t,title:(0,a.__)(e.label,"consistency"),initialOpen:!1},[...Q].filter((t=>t.category===e.slug)).map(((e,t)=>(0,c.createElement)(F,{key:t,settingSlug:e.slug,settingName:e.name,settingDescription:{__html:e.description}}))))))),{canUser:W}=(0,s.select)("core"),{getBlock:R,getBlocks:M,getBlockAttributes:$,getSelectionStart:A,isTyping:q}=(0,s.select)("core/block-editor"),{updateBlock:z,selectionChange:I,updateBlockAttributes:L}=(0,s.dispatch)("core/block-editor"),D=t=>{const{currentBlockId:s,isPasting:n,settings:o}=t;let c=Q.filter((e=>!0===o?.find((t=>t.slug===e.slug))?.value));const a=R(s);if(!(e=>{const t=E(e);return!!k.includes(t)})(s)||!(e=>{const t=x(e);return!(!t||!t.hasOwnProperty("content")||""===t.content)})(s))return;let r=$(s),i=!1;Object.entries(c).forEach((([t,o])=>{if(!T(o.slug)||i)return;e.g.consistencyLoop++,(t=>{e.g.consistencyLoop>=100&&(t=>{const s=w(t);v(t,{...s,attributes:{...s.attributes,content:s.attributes.content.slice(-2)}}),e.g.consistency_loop=0,console.log("Consistency - a memory leak has occured during the fix of the following block:",s)})(t)})(s);let c,l=o.replace,u="",p="",d=0,g=r.content,y=(e=>e.replace(/<\b(code|pre|kbd)\b>.*?<\/\b(code|pre|kbd)\b>/gi,"").replace(/(<([^>]+)>)/gi,""))(g),m=!1;if(q()||(m=o.mask.test(y)),q()){c=A(a.name),d=c?.offset||0;const e=(e=>{const t=document.querySelector(`#block-${e}`);if(null===t)return;const s=document.getSelection(),n=s?.getRangeAt(0);if(!n.collapsed)return;const o=n.cloneRange(),c=document.createTextNode("\0");o.insertNode(c);let a=t?.innerHTML?.indexOf("\0");c.parentNode.removeChild(c),t.normalize();const r=(t?.innerHTML.match(/&nbsp;/g)||[]).length;return r>0&&(a=a-6*r+r),a})(s)||d,t=y.match(o.mask);if(null===t||0===t.length)return;const n=t[0].length||1;u=g.substring(0,e-n),p=g.substring(e-n,g.length),m=o.mask.test(y)&&o.mask.test(p)}if(!m)return;if((e=>!!f.includes(e.slug))(o)&&(l=((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 a="";0!==[...e.replace.matchAll(/[0-9]/g)].length&&(a=e.replace.substring([...e.replace.matchAll(/[0-9]/g)].pop().index+1,e.replace.length-1));const r=new RegExp(`${n}`,"g"),i=new RegExp(`${o}`,"g");return(t.match(r)||[]).length===(t.match(i)||[]).length?n+c:a+o})(o,g)),0!==d&&(g=u+p.replace(o.mask,l)),0===d&&(g=g.replace(o.mask,o.replace)),e.g.previousFixCanceled)return void(e.g.previousFixCanceled=!1);if(e.g.previousFixCanceled||(z(s,{...a,attributes:{...a.attributes,content:g}}),i=!0),0===d||n)return;const h="function"==typeof o.nbMoved?o.nbMoved(p):o.nbMoved;h<0&&I(s,c.attributeKey,d+h,d+h),h>0&&I(s,c.attributeKey,d+1+h,d+h),0===h&&I(s,c.attributeKey,d,d)})),e.g.consistencyLoop=0},{getSelectedBlockClientId:N,isTyping:G,getBlockAttributes:O}=(0,s.select)("core/block-editor");(0,t.registerPlugin)("consistency-custom-sidebar",{render:()=>{const e=W("create","users");return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(r.PluginSidebar,{name:"consistency-custom-sidebar",title:(0,a.__)("Consistency","consistency"),icon:l},(0,c.createElement)(g,null),e&&(0,c.createElement)(P,null)),(0,c.createElement)(r.PluginSidebarMoreMenuItem,{target:"consistency-custom-sidebar"},(0,a.__)("Consistency Settings","consistency")))}}),o()((()=>{e.g.consistencyLoop=0,e.g.previousFixCanceledContent="",e.g.previousFixCanceled=!1,e.g.contentPasted=!1,e.g.isPasteEventAttached=!1,e.g.isEditorInIframe=null!==document.querySelector('iframe[name="editor-canvas"]'),document.querySelector("#editor")?.addEventListener("keydown",(t=>{90===t.keyCode&&(t.ctrlKey||t.metaKey)&&(e.g.previousFixCanceled=!0,t.preventDefault())})),(0,s.subscribe)((()=>{(()=>{if((()=>{const t=null!==document.querySelector('iframe[name="editor-canvas"]');e.g.isEditorInIframe!==t&&(e.g.isEditorInIframe=t,e.g.isPasteEventAttached=!1)})(),!e.g.isPasteEventAttached){if(e.g.isEditorInIframe){const t=document.querySelector('iframe[name="editor-canvas"]');t&&(t.onload=()=>{(t.contentDocument||t.contentWindow.document).addEventListener("paste",(t=>{e.g.contentPasted=!0,e.g.isPasteEventAttached=!0}))},"complete"===t.contentWindow.document.readyState&&t.onload())}e.g.isEditorInIframe||document.querySelector("#editor")?.addEventListener("paste",(t=>{e.g.contentPasted=!0,e.g.isPasteEventAttached=!0}))}})();const{onTheFly:t,onPaste:n}=(()=>{const e={onTheFly:!1,onPaste:!1},t=(0,s.select)(u.store).getCurrentUser(),n=y("root","user",t?.id||0,"consistency_plugin_user_settings"),o=n?.meta?.consistency_plugin_user_settings;return e.onTheFly=o?.find((e=>"on_the_fly"===e.slug))?.value||!1,e.onPaste=o?.find((e=>"on_paste"===e.slug))?.value||!1,e})();if(!t&&!n)return;const o=m();if(void 0===o)return;if(e.g.contentPasted&&n)return void(t=>{const{settings:s}=t;let n=Q.filter((e=>!0===s?.find((t=>t.slug===e.slug))?.value));const o=M(),c=o.flatMap((({innerBlocks:e,...t})=>e.map((e=>({...t,...e}))))),a=o.reduce(((e,t)=>{let s=t.attributes?.content;return k.includes(t.name)&&void 0!==s?(Object.entries(n).forEach((([e,t])=>{if(T(t.slug)){if(f.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(!f.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(a).length>0&&e.g.contentPasted&&(e.g.contentPasted=!1,L(Object.keys(a),a,!0)),e.g.contentPasted=!1,c.forEach((e=>{if(!k.includes(e.name))return;const t=e.clientId;e?.clientId&&D({currentBlockId:t,theRegs:n,isPasting:!0})}))})({settings:o});const c=N();if(null===c||e.g.contentPasted||!t)return;const a=O(c);a.hasOwnProperty("content")&&e.g.previousFixCanceledContent===a.content||(e.g.previousFixCanceledContent=a.content,G()&&D({currentBlockId:c,isPasting:!1,settings:o}))}))}))})();
  • consistency/trunk/changelog.txt

    r3122806 r3130518  
    22
    33This file contains only old changelog. See readme.txt for newer versions.
     4
     5= 1.5.9 =
     6* Add rule for percentages symbols
     7* Refactor some code
     8* Actualise Readme
    49
    510= 1.5.8 =
  • consistency/trunk/consistency.php

    r3125834 r3130518  
    44 * Plugin URI:        https://www.webaxones.com
    55 * Description:       Fixes typographical consistency
    6  * Version:           1.6.5
     6 * Version:           1.7.0
    77 * Requires at least: 6.1
    88 * Requires PHP:      7.4
  • consistency/trunk/includes/Config/RestSchema.php

    r2857933 r3130518  
    1010{
    1111    /**
    12      * Schema of Global settings in REST API
     12     * Schema of rules settings in REST API
    1313     *
    14      * @var array $globalSetting Schema of Global settings in REST API used in register_settings
     14     * @var array $ruleSettingSchema Schema of the setting in the REST API used in register_setting, which will contain the correction rules.
    1515     */
    16     public static array $globalSetting = [
     16    public static array $ruleSettingSchema = [
    1717        'items' => [
    1818            'type'       => 'object',
     
    3131     * Schema of User Meta Settings in REST API
    3232     *
    33      * @var array $userMeta Schema of User Meta Settings in REST API used in register_meta
     33     * @var array $userMetaSchema Schema of the user meta in the REST API used in register_meta, which will contain the user choices for corrections (e.g., fix on paste, on the fly).
    3434     */
    35     public static array $userMeta = [
     35    public static array $userMetaSchema = [
    3636        'items' => [
    3737            'type'       => 'object',
  • consistency/trunk/includes/Config/UserSettings.php

    r2857933 r3130518  
    2626            'value' => true,
    2727        ],
    28         [
    29             'slug'  => 'on_selection',
    30             'value' => false,
    31         ],
    3228    ];
    3329
  • consistency/trunk/includes/MetaData/MetaData.php

    r3122806 r3130518  
    8787
    8888    /**
    89      * Set currentValue from database
     89     * Fetch and set the current value from the database.
     90     *
     91     * This method retrieves the current value from the database using the get() method
     92     * and assigns it to the currentValue property.
    9093     *
    9194     * @return void
    9295     */
    93     public function setCurrentValue(): void
     96    public function fetchAndSetCurrentValue(): void
    9497    {
    9598        $this->currentValue = $this->get();
     
    109112    public function add(): void
    110113    {
    111         $this->setCurrentValue();
     114        $this->fetchAndSetCurrentValue();
    112115
    113116        if ( ! empty( $this->currentValue ) ) {
  • consistency/trunk/includes/Option/Option.php

    r2859754 r3130518  
    5454    public function get()
    5555    {
    56         return get_option( $this->optionName );
     56        return get_option( $this->optionName, null );
    5757    }
    5858
     
    6262    public function add(): void
    6363    {
    64         if ( false !== $this->get() ) {
     64        if ( null !== $this->get() ) {
    6565            $this->update( $this->optionName, $this->get(), $this->value );
    6666        }
    6767
    68         if ( false === $this->get() ) {
     68        if ( null === $this->get() ) {
    6969            add_option( $this->optionName, $this->value );
    7070        }
  • consistency/trunk/includes/Plugin.php

    r3125834 r3130518  
    55
    66use Webaxones\Consistency\Config\Languages;
     7use Webaxones\Consistency\Config\LocalizationManagement;
    78use Webaxones\Consistency\Config\UserSettings;
    89use Webaxones\Consistency\Config\RestSchema;
     
    3233    protected static function setConstants(): void
    3334    {
    34         defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.6.5' );
     35        defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.7.0' );
    3536        defined( __NAMESPACE__ . '\PLUGIN_URL' ) || define( __NAMESPACE__ . '\PLUGIN_URL', plugin_dir_url( __DIR__ ) );
    3637        defined( __NAMESPACE__ . '\PLUGIN_PATH' ) || define( __NAMESPACE__ . '\PLUGIN_PATH', plugin_dir_path( __DIR__ ) );
    3738        defined( __NAMESPACE__ . '\OPTION_GROUP' ) || define( __NAMESPACE__ . '\OPTION_GROUP', 'consistency_plugin' );
    38         defined( __NAMESPACE__ . '\MAIN_OPTION_NAME' ) || define( __NAMESPACE__ . '\MAIN_OPTION_NAME', 'consistency_plugin_settings' );
     39        defined( __NAMESPACE__ . '\LOCALIZED_RULES_OPTION_NAME' ) || define( __NAMESPACE__ . '\LOCALIZED_RULES_OPTION_NAME', 'consistency_plugin_settings' );
     40        defined( __NAMESPACE__ . '\LOCALIZATION_MANAGEMENT_OPTION_NAME' ) || define( __NAMESPACE__ . '\LOCALIZATION_MANAGEMENT_OPTION_NAME', 'consistency_plugin_localization_management' );
    3941        defined( __NAMESPACE__ . '\USER_SETTINGS_META_KEY' ) || define( __NAMESPACE__ . '\USER_SETTINGS_META_KEY', 'consistency_plugin_user_settings' );
    4042    }
     
    5456        $hooks->register( $assets );
    5557
    56         // Register default global settings in main option depending on language
    57         $languages = new Languages( LocalizedRules::$list );
    58         $option    = new Option( MAIN_OPTION_NAME, $languages );
    59         $hooks->register( $option );
     58        // Register localized rules in options, listing the locales that use each correction depending on the language
     59        $languages      = new Languages( LocalizedRules::$list );
     60        $localizedRules = new Option( LOCALIZED_RULES_OPTION_NAME, $languages );
     61        $hooks->register( $localizedRules );
    6062
    61         // Declare REST Schema for global settings
    62         $setting = new Setting( MAIN_OPTION_NAME, 'array', RestSchema::$globalSetting );
    63         $hooks->register( $setting );
     63        // Declare REST Schema for global rules settings
     64        $ruleSetting = new Setting( LOCALIZED_RULES_OPTION_NAME, 'array', RestSchema::$ruleSettingSchema );
     65        $hooks->register( $ruleSetting );
     66
     67        // Register an option to check if the correction rules are localized or not: if not, the rules are applied to all locales.
     68        // Can be disabled with a filter.
     69        // ie: add_filter( 'Consistency\only_show_locale_correction_rules', '__return_false' );
     70        $localizationManagement = new LocalizationManagement( apply_filters( 'Consistency\only_show_locale_correction_rules', 1 ) );
     71        $localization = new Option( LOCALIZATION_MANAGEMENT_OPTION_NAME, $localizationManagement );
     72        $hooks->register( $localization );
     73
     74        // Declare REST Schema for global localization management settings
     75        $localizationManagementSetting = new Setting( LOCALIZATION_MANAGEMENT_OPTION_NAME, 'boolean', true );
     76        $hooks->register( $localizationManagementSetting );
    6477
    6578        // Get current user
     
    7386
    7487        // Declare REST Schema for user settings
    75         $meta = new Meta( USER_SETTINGS_META_KEY, 'array', RestSchema::$userMeta, 'edit_posts', $currentUser );
     88        $meta = new Meta( USER_SETTINGS_META_KEY, 'array', RestSchema::$userMetaSchema, 'edit_posts', $currentUser );
    7689        $hooks->register( $meta );
    7790
  • consistency/trunk/includes/Setting/Setting.php

    r2859754 r3130518  
    8181            'sanitize_callback' => [ $this, 'sanitizeCallback' ],
    8282        ];
     83
    8384        register_setting( $this->optionGroup, $this->optionName, $args );
    8485    }
  • consistency/trunk/package.json

    r3125834 r3130518  
    11{
    22    "name": "consistency",
    3     "version": "1.6.5",
     3    "version": "1.7.0",
    44    "description": "",
    55    "main": "index.js",
  • consistency/trunk/readme.md

    r3123688 r3130518  
    55Fixes typographic errors when typing in the WordPress editor. 
    66
    7 Do you see the typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.
     7Have you seen the typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.
    88 
    99See [WordPress directory page](https://wordpress.org/plugins/consistency/).
     
    3535## Description
    3636
    37 The purpose of this plugin is to provide a tool allowing administrators to define typographical rules in order to maintain typographical consistency in the text contents entered on the editor. 
     37This WordPress plugin ensures consistent typography on your site.
     38 
    3839> [!IMPORTANT]
    3940> The corrections are automatic and are made during the entry as well as on a copy paste. 
     
    7172
    7273    
     74
     75If your locale is not supported by Consistency but you still want to access all available rules, you can disable the localization of rules via a filter. Add this to your theme's functions.php file:
     76
     77```PHP
     78add_filter( 'Consistency\only_show_locale_correction_rules', '__return_false' );
     79```
     80
     81All correction rules will then appear, with automatic management of rule incompatibilities (if rule A is enabled and it is incompatible with rule B, rule B will be grayed out).
     82
    7383> [!TIP]
    7484> **Ctrl+Z** or **Cmd+Z** right after a correction disables the correction for the next keystroke. It is thus possible to force the non-correction of a character.
  • consistency/trunk/readme.txt

    r3125834 r3130518  
    44Requires at least: 6.1
    55Tested up to: 6.6
    6 Stable tag: 1.6.5
     6Stable tag: 1.7.0
    77Requires PHP: 7.4
    88License: GPL-3.0-or-later
     
    1313== Description ==
    1414
    15 Do you see the typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.
     15Have you seen the typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.
    1616
    17 This WordPress plugin is designed to help administrators enforce consistent typography in text content entered in the editor.
     17This WordPress plugin ensures consistent typography on your site.
    1818Corrections are applied automatically both during text entry and when pasting text.
    19 Users can enable or disable autocorrect rules as needed.
     19
     20All users can choose to enable or disable corrections, but only administrators can configure the correction rules.
    2021Autocorrect is available for pages, posts, and custom post types (if they are configured to use the Rest API).
     22The available automatic corrections are listed on [the plugin repository on github](https://github.com/webaxones/consistency/) and are categorized as follows: Apostrophes, Quotation Marks, Dashes, Suffixes, Spaces, Case, Ellipsis, Symbols.
    2123
    22 Automatic fixes are listed on [the plugin repository on github](https://github.com/webaxones/consistency/).
     24Pressing Ctrl+Z or Cmd+Z immediately after a correction disables the correction for the next keystroke.
    2325
     26== Technical Information ==
    2427
    25 
    26 Ctrl+Z or Cmd+Z right after a correction disables the correction for the next keystroke
    27 
    28 Technically, rules are saved in the wp_options table, while active/inactive states are saved as user meta data.
     28**Data Storage**: Rules are saved in the wp_options table, while active/inactive states are saved as user meta data.
    2929This data is deleted when the plugin is uninstalled.
    3030
    31 Settings are directly in a plugin sidebar under the Block Editor: no more searching for an options page, always available and discreet.
     31**Settings Location**: Settings are directly in a plugin sidebar under the Block Editor: no more searching for an options page, always available and discreet.
    3232
    33 The locales supported by this plugin are:
     33**Supported Locales**: The locales supported by this plugin are:
    3434'fr_FR', 'fr_BE', 'en_US', 'en_AU', 'en_CA', 'en_NZ', 'en_ZA', 'en_GB', 'de_DE', 'de_AT', 'de_CH', 'ro_RO'
     35
     36If your locale is not supported by Consistency but you still want to access all available rules, you can disable the localization of rules via a filter. Add this to your theme's functions.php file:
     37`add_filter( 'Consistency\only_show_locale_correction_rules', '__return_false' );`
     38All correction rules will then appear, with automatic management of rule incompatibilities (if rule A is enabled and it is incompatible with rule B, rule B will be grayed out).
    3539
    3640== Screenshots ==
    3741
    38 1. Apostrophes
    39 2. Quotation marks
    40 3. Dashes
    41 4. Suffixes
    42 5. Spaces
    43 6. Case
    44 7. Ellipsis
    45 8. Symbols
     421. Actions Settings: These settings can be seen and modified by all user roles, unlike the following ones relating to correction rules which can only be seen and modified by an administrator role.
     432. Apostrophes
     443. Quotation marks
     454. Dashes
     465. Suffixes
     476. Spaces
     487. Case
     498. Ellipsis
     509. Symbols
    4651
    4752== Installation ==
     
    50552. Configure the rules in the editor.
    5156
     57== Frequently Asked Questions ==
     58
     59= Does this plugin modify my content? =
     60
     61Yes, the saved content will be the one modified by the plugin, but you can see the changes being made in real time and you can choose to accept or reject them.
     62
     63= Will this plugin slow down my page loading time? =
     64
     65Absolutely not, since nothing is done on the front end. The processing only occurs when you enter content.
     66
     67
    5268== Changelog ==
     69
     70= 1.7.0 =
     71* Add: Add the ability to display all correction rules regardless of the current locale with a filter (Consistency\only_show_locale_correction_rules)
     72* Add: Prevents incompatible fixes from being enabled when locale limiting has been disabled by the filter
     73* Add: Update readme
    5374
    5475= 1.6.5 =
     
    7394* Fix: Separate old changelog and new logs in 2 files
    7495
    75 = 1.5.9 =
    76 * Add rule for percentages symbols
    77 * Refactor some code
    78 * Actualise Readme
    79 
    8096See [changelog.txt](https://plugins.svn.wordpress.org/consistency/trunk/changelog.txt) for older changelog
  • consistency/trunk/src/app/checks.js

    r3092549 r3130518  
    1818import { processedBlocks } from '../config/processedBlocks'
    1919import { aMemoryLeakHasOccured } from './helpers'
     20import { ruleIncompatibilities } from '../config/ruleIncompatibilities'
     21import { getGlobalSettings } from './data'
    2022
    2123const { getBlockName, getBlockAttributes } = select( 'core/block-editor' )
     
    9698
    9799}
     100
     101/**
     102 * Checks if at least one incompatible rule of the current rule is enabled.
     103 *
     104 * @param {string} currentRule - The current rule to check.
     105 * @returns {boolean} - Returns true if at least one incompatible rule is enabled, otherwise false.
     106 */
     107export const checkRuleCompatibility = currentRule => {
     108
     109    // Get the current rule from the ruleIncompatibilities array
     110    const rule = ruleIncompatibilities.find( rule => rule.slug === currentRule )
     111    if ( ! rule ) return false
     112
     113    // Check if at least one incompatible rule is enabled
     114    return rule.incompatibleWith.some( incompatibleRule => {
     115        // Return the state of the incompatible rule
     116        return getGlobalSettings()?.find( setting => setting.slug === incompatibleRule )?.value
     117    } )
     118
     119}
  • consistency/trunk/src/app/data.js

    r3083522 r3130518  
    2424
    2525    return globalSettings
     26
     27}
     28
     29/**
     30 * Retrieves the localization management setting from the site entity.
     31 * @returns {any} The localization management setting.
     32 */
     33export const getLocalizationManagementSetting = () => {
     34   
     35    const siteEntity = getEntityRecord( 'root', 'site' )
     36    const localizationManagementSetting = siteEntity?.consistency_plugin_localization_management
     37
     38    return localizationManagementSetting
    2639
    2740}
  • consistency/trunk/src/components/GlobalSettingPanel.js

    r3122806 r3130518  
    1010 */
    1111import { __ } from '@wordpress/i18n'
    12 import { Panel, PanelHeader, PanelBody, PanelRow } from '@wordpress/components'
     12import { Panel, PanelHeader, PanelBody } from '@wordpress/components'
    1313
    1414/**
    1515 * External dependencies
    1616 */
     17import { LocaleLabel } from './LocaleLabel'
    1718import { GlobalSettingToggle } from './GlobalSettingToggle'
    1819import { rules } from '../config/rules'
     
    2425const GlobalSettingPanel = () => (
    2526    <Panel className='GlobalSettingPanel'>
    26         <PanelHeader><strong>{ __( 'Global correction rules', 'consistency' ) }</strong></PanelHeader>
     27        <PanelHeader>
     28            <strong>{ __( 'Global correction rules', 'consistency' ) }<LocaleLabel /></strong>
     29        </PanelHeader>
    2730        {
    2831            [ ...categories ].map( ( cat, key ) => {
  • consistency/trunk/src/components/GlobalSettingToggle.js

    r3086094 r3130518  
    1919 */
    2020import { isUsedByLocale } from '../app/checks'
     21import { getLocalizationManagementSetting } from '../app/data'
     22import { checkRuleCompatibility } from '../app/checks'
    2123
    2224export const GlobalSettingToggle = props => {
    2325
    2426    const { settingSlug, settingName, settingDescription } = props
     27    const { createNotice } = useDispatch( noticesStore )
    2528
    26     if ( ! isUsedByLocale( settingSlug ) ) return ''
     29    if ( getLocalizationManagementSetting() && ! isUsedByLocale( settingSlug ) ) return ''
    2730
    2831    const [ settings, setSettings ] = useEntityProp(
     
    3437
    3538    const { saveEditedEntityRecord } = useDispatch( coreStore )
    36     const { createNotice } = useDispatch( noticesStore )
    3739       
    3840    const onSettingChanged = value => {
     
    4446            return obj
    4547        } )
    46 
    47         if ( ! newSettings?.find( x => x.slug === settingSlug ) ) {
    48             newSettings.push( { slug: settingSlug, value: value } )
    49         }
    5048
    5149        setSettings( newSettings )
     
    5957            { isDismissible: true, type: 'snackbar', speak: true }
    6058        )
     59
    6160    }
    6261
     
    6766                help={ ( <span dangerouslySetInnerHTML={ settingDescription } /> ) }
    6867                checked={ settings?.find( x => x.slug === settingSlug )?.value || false }
     68                disabled={ checkRuleCompatibility( settingSlug ) }
    6969                onChange={ onSettingChanged }
    7070            />
  • consistency/trunk/src/components/UserSettingPanel.js

    r3122806 r3130518  
    2222const UserSettingPanel = () => (
    2323    <Panel className='UserSettingPanel'>
    24         <PanelHeader><strong>{ __( 'Settings for my account', 'consistency' ) }</strong></PanelHeader>
     24        <PanelHeader><strong>{ __( 'Settings for my account', 'consistency' ) }</strong><br/></PanelHeader>
    2525        <div style={{ padding: 16 }}>
    2626            <PanelRow>
  • consistency/trunk/src/config/rules.js

    r3122806 r3130518  
    1313export const rules = [
    1414    {
    15         // Replaces straight quote with curly quote
     15        // Replaces straight apostrophes with curly apostrophes
    1616        slug: 'quote', // slug of the setting and the related regex
    17         name: __( 'Straight quote', 'consistency' ), // name of the setting
    18         description: __( 'Replaces straight quotes with curved quotes:', 'consistency' )
     17        name: __( 'Straight Apostrophe', 'consistency' ), // name of the setting
     18        description: __( 'Replace straight apostrophes with curly apostrophes:', 'consistency' )
    1919            + `<span aria-hidden='true' style='display:block;'><code>'</code> <span style='font-size:20px'>→</span> <code>’</code></span>`, // description of the setting
    2020        mask: /\'/, // mask
     
    2424    },
    2525    {
    26         // Replaces two hyphens with En dash
     26        // Replaces two hyphens with an En dash
    2727        slug: '2hyphens',
    28         name: __( 'En dash', 'consistency' ),
    29         description: __( 'Replaces 2 hyphens with En dash:', 'consistency' )
     28        name: __( 'En Dash', 'consistency' ),
     29        description: __( 'Replace two hyphens with an en dash:', 'consistency' )
    3030            + `<span aria-hidden='true' style='display:block;'><code>--</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">–</code></span>`,
    3131        mask: /(?:\-)\-/,
     
    3737        // Replaces three hyphens with Em dash
    3838        slug: '3hyphens',
    39         name: __( 'Em dash', 'consistency' ),
    40         description: __( 'Replaces 3 hyphens with Em dash:', 'consistency' )
     39        name: __( 'Em Dash', 'consistency' ),
     40        description: __( 'Replace three hyphens with an em dash:', 'consistency' )
    4141            + `<span aria-hidden='true' style='display:block;'><code>---</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">—</code></span>`,
    4242        mask: /(?:\–|\-\-)\-/,
     
    4949    },
    5050    {
    51         // Replaces four hyphens with Two-Em dash
     51        // Replaces four hyphens with two-em dash
    5252        slug: '4hyphens',
    53         name: __( 'Two-Em dash', 'consistency' ),
    54         description: __( 'Replaces 4 hyphens with Two-Em dash:', 'consistency' )
     53        name: __( 'Two-Em Dash', 'consistency' ),
     54        description: __( 'Replace four hyphens with two-em dash:', 'consistency' )
    5555            + `<span aria-hidden='true' style='display:block;'><code>----</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">⸺</code></span>`,
    5656        mask: /(?:\—|\–\-|\-\-\-)\-/,
     
    6363    },
    6464    {
    65         // Adds HTML tag sup to ordinal number suffix
     65        // Add the sup HTML tag to ordinal number suffixes
    6666        slug: 'ordinalNumberSuffix',
    67         name: __( 'Ordinal number suffix', 'consistency' ),
    68         description: __( 'Add HTML tag sup to ordinal number suffix', 'consistency' )
     67        name: __( 'Ordinal Number Suffix', 'consistency' ),
     68        description: __( 'Add the sup HTML tag to ordinal number suffixes', 'consistency' )
    6969        + `<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>`,
    7070        mask: /([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/,
     
    7474    },
    7575    {
    76         // Replaces regular quotes with curly quotes
     76        // Replaces straight quotes with curly quotes
    7777        slug: 'regularToCurlyQuotes',
    78         name: __( 'Curly quotes', 'consistency' ),
    79         description: __( 'Replaces regular quotes with curly quotes:', 'consistency' )
     78        name: __( 'Curly Quotes', 'consistency' ),
     79        description: __( 'Replace straight quotes with curly quotes:', 'consistency' )
    8080            + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>“ ”</code></span>`,
    8181        mask: /"/, // specific mask with specific process
     
    8585    },
    8686    {
    87         // Replaces regular quotes with german quotes
     87        // Replaces straight quotes with german quotes
    8888        slug: 'regularToGermanQuotes',
    89         name: __( 'Regular quotes to german', 'consistency' ),
    90         description: __( 'Replaces regular quotes with german quotes:', 'consistency' )
     89        name: __( 'German Quotes', 'consistency' ),
     90        description: __( 'Replace straight quotes with german quotes:', 'consistency' )
    9191        + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>„ “</code></span>`,
    9292        mask: /"/, // specific mask with specific process
     
    9696    },
    9797    {
    98         // Replaces regular quotes with german book-style quotes
     98        // Replaces straight quotes with german book-style quotes
    9999        slug: 'regularToGermanBookStyleQuotes',
    100         name: __( 'Regular quotes to german book-style quotes', 'consistency' ),
    101         description: __( 'Replaces regular quotes with german book-style quotes:', 'consistency' )
     100        name: __( 'German Book-Style Quotes', 'consistency' ),
     101        description: __( 'Replace straight quotes with german book-style quotes:', 'consistency' )
    102102            + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>» «</code></span>`,
    103103        mask: /"/, // specific mask with specific process
     
    107107    },
    108108    {
    109         // Replaces regular quotes with french quotes
     109        // Replaces straight quotes with french quotes
    110110        slug: 'regularToFrenchQuotes',
    111         name: __( 'Regular quotes to french', 'consistency' ),
    112         description: __( 'Replaces regular quotes with french quotes:', 'consistency' )
     111        name: __( 'French Quotes with Spaces', 'consistency' ),
     112        description: __( 'Replace straight quotes with french quotes with non-breaking spaces:', 'consistency' )
    113113            + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>`,
    114114        mask: /"/, // specific mask with specific process
     
    120120        // Replaces regular quotes with french quotes without spaces
    121121        slug: 'regularToFrenchQuotesWithoutSpaces',
    122         name: __( 'Regular quotes to french quotes without spaces', 'consistency' ),
    123         description: __( 'Replaces regular quotes with french quotes without spaces:', 'consistency' )
     122        name: __( 'French Quotes', 'consistency' ),
     123        description: __( 'Replace straight quotes with french quotes without spaces:', 'consistency' )
    124124            + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>« »</code></span>`,
    125125        mask: /"/, // specific mask with specific process
     
    131131        // Replaces curly quotes with french quotes
    132132        slug: 'curlyToFrenchQuotes',
    133         name: __( 'Curly quotes to french quotes', 'consistency' ),
    134         description: __( 'Replaces curly quotes with french quotes:', 'consistency' )
     133        name: __( 'Curly Quotes to French Quotes', 'consistency' ),
     134        description: __( 'Replace curly quotes with french quotes with non-breaking spaces:', 'consistency' )
    135135            + `<span aria-hidden='true' style='display:block;'><code>“ ”</code> <span style='font-size:20px'>→</span> <code>«   »</code></span>`,
    136136        mask: /“.*?”/, // specific mask with specific process
     
    142142        // Replaces a breaking space followed by a character from this list [? ! : ; » € $ £ ¥ ₽ 元 %] with a non-breaking space
    143143        slug: 'breakingSpace',
    144         name: __( 'Breaking space', 'consistency' ),
    145         description: sprintf( __( 'Replaces a breaking space followed by a character from this list:%1$s with a non-breaking space', 'consistency' )
     144        name: __( 'Breaking Spaces', 'consistency' ),
     145        description: sprintf( __( 'Replace a breaking space followed by a character from this list:%1$s with a non-breaking space', 'consistency' )
    146146            , `<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />` ),
    147147        mask: / ([\?|\!|\:|\;|\»|\€|\$|\£|\¥|\₽|\元|\%])/,
     
    153153        // Adds a non-breaking space before a character from this list [? ! : ; » € $ £ ¥ ₽ 元 %] having no space before
    154154        slug: 'noSpaceBefore',
    155         name: __( 'No space before', 'consistency' ),
    156         description: sprintf( __( 'Adds a non-breaking space before a character from this list:%1$s having no space before', 'consistency' )
     155        name: __( 'No Space Before', 'consistency' ),
     156        description: sprintf( __( 'Add a non-breaking space before a character from this list:%1$s having no space before', 'consistency' )
    157157            , `<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />` ),
    158158        mask: /(?<! | |&nbsp;)([\?|\!|\:|\»|\€|\$|\£|\¥|\₽|\元|\%])/,
     
    164164        // Removes any space preceding a character from this list [? ! : ; %]
    165165        slug: 'spaceBefore',
    166         name: __( 'Space before', 'consistency' ),
     166        name: __( 'Space Before', 'consistency' ),
    167167        description: __( 'Remove any space preceding a character from this list:', 'consistency' )
    168168            + `<span style='display:block;'><code>? ! : ; %</code></span>`,
     
    175175        // Adds a breaking space after a character from this list [, … ) ]] if this character is followed with another character except [, .] and a number
    176176        slug: 'noBreakingSpaceAfter',
    177         name: __( 'No breaking space after', 'consistency' ),
    178         description: sprintf( __( 'Adds a breaking space after a character from this list:%1$s when followed with another character', 'consistency' )
     177        name: __( 'No Breaking Space After', 'consistency' ),
     178        description: sprintf( __( 'Add a breaking space after a character from this list:%1$s when followed with another character', 'consistency' )
    179179            , `<br /><code>, … ) ]</code><br />` ),
    180180        mask: /([\,|\…|\)|\]])(?! | |\.|\,|\d|$)(.)/,
     
    186186        // Adds a non-breaking space after [«] having no space after
    187187        slug: 'noNonBreakingSpaceAfter',
    188         name: __( 'No non breaking space after', 'consistency' ),
    189         description: __( 'Adds a non-breaking space after open french quote having no space after', 'consistency' ),
     188        name: __( 'No Non-Breaking Space After', 'consistency' ),
     189        description: __( 'Add a non-breaking space after open french quote having no space after', 'consistency' ),
    190190        mask: /(«)(?! | |&nbsp;)/,
    191191        replace: '$1 ',
     
    196196        // Capitalize the first letter of a sentence
    197197        slug: 'capitalizeFirstSentenceLetter',
    198         name: __( 'First sentence letter not capitalized', 'consistency' ),
     198        name: __( 'First Sentence Letter', 'consistency' ),
    199199        description: __( 'Capitalize the first letter of a sentence', 'consistency' ),
    200200        mask: /(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|\…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/,
     
    206206        // Replaces etc... with etc.
    207207        slug: 'etcThreeDots',
    208         name: __( '3 dots following "etc"', 'consistency' ),
    209         description: __( 'Replaces 3 dots placed after the abbreviation "etc" with a point:', 'consistency' )
     208        name: __( 'Three Dots Following "etc"', 'consistency' ),
     209        description: __( 'Replace 3 dots placed after the abbreviation "etc" with a period:', 'consistency' )
    210210        + `<span aria-hidden='true' style='display:block;'><code>etc...</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`,
    211211        mask: /etc(\.{3})/i,
     
    217217        // Replaces etc.. with etc.
    218218        slug: 'etcTwoDots',
    219         name: __( '2 dots following "etc"', 'consistency' ),
    220         description: __( 'Replaces 2 dots placed after the abbreviation "etc" with a point:', 'consistency' )
     219        name: __( 'Two Dots Following "etc"', 'consistency' ),
     220        description: __( 'Replace 2 dots placed after the abbreviation "etc" with a period:', 'consistency' )
    221221        + `<span aria-hidden='true' style='display:block;'><code>etc..</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`,
    222222        mask: /etc(\.{2})/i,
     
    228228        // Replaces etc… with etc.
    229229        slug: 'etcEllipsis',
    230         name: __( 'Ellipsis following "etc"', 'consistency' ),
    231         description: __( 'Replaces ellipsis placed after the abbreviation "etc" with a point:', 'consistency' )
     230        name: __( 'Ellipsis Following "etc"', 'consistency' ),
     231        description: __( 'Replace the ellipsis placed after the abbreviation "etc" with a period:', 'consistency' )
    232232        + `<span aria-hidden='true' style='display:block;'><code>etc…</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`,
    233233        mask: /etc(\.{3}|…)/i,
     
    250250        // Replaces a character from this list [c p r] when enclosed in parentheses with a symbol
    251251        slug: 'symbolInACircle',
    252         name: __( 'Symbol in a circle', 'consistency' ),
     252        name: __( 'Symbol in a Circle', 'consistency' ),
    253253        description: __( 'Replaces 1 character placed in parentheses with a symbol', 'consistency' )
    254254            + `<span aria-hidden='true' style='display:block;'><code>(c) (p) (r)</code> <span style='font-size:20px'>→</span> <code>© ℗ ®</code></span>`,
     
    271271        // Replaces a character from this list [md tm mc sm] with a symbol in small caps and superscript style
    272272        slug: 'symbolInSmallCapsAndSuperscriptStyle',
    273         name: __( 'Symbol in small caps and superscript style', 'consistency' ),
     273        name: __( 'Symbol in Small Caps and Superscript Style', 'consistency' ),
    274274        description: __( 'Replaces 2-character abbreviations with a symbol in small caps and superscript style', 'consistency' )
    275275        + `<span aria-hidden='true' style='display:block;'><code>tm sm md mc</code> <span style='font-size:20px'>→</span> <code>™ ℠ 🅫 🅪</code></span>`,
Note: See TracChangeset for help on using the changeset viewer.