Changeset 3130518
- Timestamp:
- 08/04/2024 04:59:07 AM (17 months ago)
- Location:
- consistency
- Files:
-
- 8 added
- 45 edited
- 1 copied
-
assets/screenshot-1.jpg (modified) (previous)
-
assets/screenshot-2.jpg (modified) (previous)
-
assets/screenshot-3.jpg (modified) (previous)
-
assets/screenshot-4.jpg (modified) (previous)
-
assets/screenshot-5.jpg (modified) (previous)
-
assets/screenshot-6.jpg (modified) (previous)
-
assets/screenshot-7.jpg (modified) (previous)
-
assets/screenshot-8.jpg (added)
-
assets/screenshot-9.jpg (added)
-
tags/1.7.0 (copied) (copied from consistency/trunk)
-
tags/1.7.0/build/index.asset.php (modified) (1 diff)
-
tags/1.7.0/build/index.js (modified) (1 diff)
-
tags/1.7.0/changelog.txt (modified) (1 diff)
-
tags/1.7.0/consistency.php (modified) (1 diff)
-
tags/1.7.0/includes/Config/LocalizationManagement.php (added)
-
tags/1.7.0/includes/Config/RestSchema.php (modified) (2 diffs)
-
tags/1.7.0/includes/Config/UserSettings.php (modified) (1 diff)
-
tags/1.7.0/includes/MetaData/MetaData.php (modified) (2 diffs)
-
tags/1.7.0/includes/Option/Option.php (modified) (2 diffs)
-
tags/1.7.0/includes/Plugin.php (modified) (4 diffs)
-
tags/1.7.0/includes/Setting/Setting.php (modified) (1 diff)
-
tags/1.7.0/package.json (modified) (1 diff)
-
tags/1.7.0/readme.md (modified) (3 diffs)
-
tags/1.7.0/readme.txt (modified) (4 diffs)
-
tags/1.7.0/src/app/checks.js (modified) (2 diffs)
-
tags/1.7.0/src/app/data.js (modified) (1 diff)
-
tags/1.7.0/src/components/GlobalSettingPanel.js (modified) (2 diffs)
-
tags/1.7.0/src/components/GlobalSettingToggle.js (modified) (5 diffs)
-
tags/1.7.0/src/components/LocaleLabel.js (added)
-
tags/1.7.0/src/components/UserSettingPanel.js (modified) (1 diff)
-
tags/1.7.0/src/config/ruleIncompatibilities.js (added)
-
tags/1.7.0/src/config/rules.js (modified) (22 diffs)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/consistency.php (modified) (1 diff)
-
trunk/includes/Config/LocalizationManagement.php (added)
-
trunk/includes/Config/RestSchema.php (modified) (2 diffs)
-
trunk/includes/Config/UserSettings.php (modified) (1 diff)
-
trunk/includes/MetaData/MetaData.php (modified) (2 diffs)
-
trunk/includes/Option/Option.php (modified) (2 diffs)
-
trunk/includes/Plugin.php (modified) (4 diffs)
-
trunk/includes/Setting/Setting.php (modified) (1 diff)
-
trunk/package.json (modified) (1 diff)
-
trunk/readme.md (modified) (3 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/src/app/checks.js (modified) (2 diffs)
-
trunk/src/app/data.js (modified) (1 diff)
-
trunk/src/components/GlobalSettingPanel.js (modified) (2 diffs)
-
trunk/src/components/GlobalSettingToggle.js (modified) (5 diffs)
-
trunk/src/components/LocaleLabel.js (added)
-
trunk/src/components/UserSettingPanel.js (modified) (1 diff)
-
trunk/src/config/ruleIncompatibilities.js (added)
-
trunk/src/config/rules.js (modified) (22 diffs)
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:/(?<! | | )([\?|\!|\:|»|€|\$|£|¥|₽|元|\%])/,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:/(«)(?! | | )/,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(/ /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:/(?<! | | )([\?|\!|\:|»|€|\$|£|¥|₽|元|\%])/,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:/(«)(?! | | )/,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(/ /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 2 2 3 3 This 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 4 9 5 10 = 1.5.8 = -
consistency/tags/1.7.0/consistency.php
r3125834 r3130518 4 4 * Plugin URI: https://www.webaxones.com 5 5 * Description: Fixes typographical consistency 6 * Version: 1. 6.56 * Version: 1.7.0 7 7 * Requires at least: 6.1 8 8 * Requires PHP: 7.4 -
consistency/tags/1.7.0/includes/Config/RestSchema.php
r2857933 r3130518 10 10 { 11 11 /** 12 * Schema of Globalsettings in REST API12 * Schema of rules settings in REST API 13 13 * 14 * @var array $ globalSetting Schema of Global settings in REST API used in register_settings14 * @var array $ruleSettingSchema Schema of the setting in the REST API used in register_setting, which will contain the correction rules. 15 15 */ 16 public static array $ globalSetting= [16 public static array $ruleSettingSchema = [ 17 17 'items' => [ 18 18 'type' => 'object', … … 31 31 * Schema of User Meta Settings in REST API 32 32 * 33 * @var array $userMeta Schema of User Meta Settings in REST API used in register_meta33 * @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). 34 34 */ 35 public static array $userMeta = [35 public static array $userMetaSchema = [ 36 36 'items' => [ 37 37 'type' => 'object', -
consistency/tags/1.7.0/includes/Config/UserSettings.php
r2857933 r3130518 26 26 'value' => true, 27 27 ], 28 [29 'slug' => 'on_selection',30 'value' => false,31 ],32 28 ]; 33 29 -
consistency/tags/1.7.0/includes/MetaData/MetaData.php
r3122806 r3130518 87 87 88 88 /** 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. 90 93 * 91 94 * @return void 92 95 */ 93 public function setCurrentValue(): void96 public function fetchAndSetCurrentValue(): void 94 97 { 95 98 $this->currentValue = $this->get(); … … 109 112 public function add(): void 110 113 { 111 $this-> setCurrentValue();114 $this->fetchAndSetCurrentValue(); 112 115 113 116 if ( ! empty( $this->currentValue ) ) { -
consistency/tags/1.7.0/includes/Option/Option.php
r2859754 r3130518 54 54 public function get() 55 55 { 56 return get_option( $this->optionName );56 return get_option( $this->optionName, null ); 57 57 } 58 58 … … 62 62 public function add(): void 63 63 { 64 if ( false!== $this->get() ) {64 if ( null !== $this->get() ) { 65 65 $this->update( $this->optionName, $this->get(), $this->value ); 66 66 } 67 67 68 if ( false=== $this->get() ) {68 if ( null === $this->get() ) { 69 69 add_option( $this->optionName, $this->value ); 70 70 } -
consistency/tags/1.7.0/includes/Plugin.php
r3125834 r3130518 5 5 6 6 use Webaxones\Consistency\Config\Languages; 7 use Webaxones\Consistency\Config\LocalizationManagement; 7 8 use Webaxones\Consistency\Config\UserSettings; 8 9 use Webaxones\Consistency\Config\RestSchema; … … 32 33 protected static function setConstants(): void 33 34 { 34 defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1. 6.5' );35 defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.7.0' ); 35 36 defined( __NAMESPACE__ . '\PLUGIN_URL' ) || define( __NAMESPACE__ . '\PLUGIN_URL', plugin_dir_url( __DIR__ ) ); 36 37 defined( __NAMESPACE__ . '\PLUGIN_PATH' ) || define( __NAMESPACE__ . '\PLUGIN_PATH', plugin_dir_path( __DIR__ ) ); 37 38 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' ); 39 41 defined( __NAMESPACE__ . '\USER_SETTINGS_META_KEY' ) || define( __NAMESPACE__ . '\USER_SETTINGS_META_KEY', 'consistency_plugin_user_settings' ); 40 42 } … … 54 56 $hooks->register( $assets ); 55 57 56 // Register default global settings in main option depending onlanguage57 $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 ); 60 62 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 ); 64 77 65 78 // Get current user … … 73 86 74 87 // 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 ); 76 89 $hooks->register( $meta ); 77 90 -
consistency/tags/1.7.0/includes/Setting/Setting.php
r2859754 r3130518 81 81 'sanitize_callback' => [ $this, 'sanitizeCallback' ], 82 82 ]; 83 83 84 register_setting( $this->optionGroup, $this->optionName, $args ); 84 85 } -
consistency/tags/1.7.0/package.json
r3125834 r3130518 1 1 { 2 2 "name": "consistency", 3 "version": "1. 6.5",3 "version": "1.7.0", 4 4 "description": "", 5 5 "main": "index.js", -
consistency/tags/1.7.0/readme.md
r3123688 r3130518 5 5 Fixes typographic errors when typing in the WordPress editor. 6 6 7 Do you seethe typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.7 Have 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. 8 8 9 9 See [WordPress directory page](https://wordpress.org/plugins/consistency/). … … 35 35 ## Description 36 36 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. 37 This WordPress plugin ensures consistent typography on your site. 38 38 39 > [!IMPORTANT] 39 40 > The corrections are automatic and are made during the entry as well as on a copy paste. … … 71 72 72 73 74 75 If 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 78 add_filter( 'Consistency\only_show_locale_correction_rules', '__return_false' ); 79 ``` 80 81 All 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 73 83 > [!TIP] 74 84 > **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 4 4 Requires at least: 6.1 5 5 Tested up to: 6.6 6 Stable tag: 1. 6.56 Stable tag: 1.7.0 7 7 Requires PHP: 7.4 8 8 License: GPL-3.0-or-later … … 13 13 == Description == 14 14 15 Do you seethe typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.15 Have 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. 16 16 17 This WordPress plugin is designed to help administrators enforce consistent typography in text content entered in the editor.17 This WordPress plugin ensures consistent typography on your site. 18 18 Corrections are applied automatically both during text entry and when pasting text. 19 Users can enable or disable autocorrect rules as needed. 19 20 All users can choose to enable or disable corrections, but only administrators can configure the correction rules. 20 21 Autocorrect is available for pages, posts, and custom post types (if they are configured to use the Rest API). 22 The 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. 21 23 22 Automatic fixes are listed on [the plugin repository on github](https://github.com/webaxones/consistency/).24 Pressing Ctrl+Z or Cmd+Z immediately after a correction disables the correction for the next keystroke. 23 25 26 == Technical Information == 24 27 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. 29 29 This data is deleted when the plugin is uninstalled. 30 30 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. 32 32 33 The locales supported by this plugin are:33 **Supported Locales**: The locales supported by this plugin are: 34 34 '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 36 If 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' );` 38 All 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). 35 39 36 40 == Screenshots == 37 41 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 42 1. 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. 43 2. Apostrophes 44 3. Quotation marks 45 4. Dashes 46 5. Suffixes 47 6. Spaces 48 7. Case 49 8. Ellipsis 50 9. Symbols 46 51 47 52 == Installation == … … 50 55 2. Configure the rules in the editor. 51 56 57 == Frequently Asked Questions == 58 59 = Does this plugin modify my content? = 60 61 Yes, 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 65 Absolutely not, since nothing is done on the front end. The processing only occurs when you enter content. 66 67 52 68 == 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 53 74 54 75 = 1.6.5 = … … 73 94 * Fix: Separate old changelog and new logs in 2 files 74 95 75 = 1.5.9 =76 * Add rule for percentages symbols77 * Refactor some code78 * Actualise Readme79 80 96 See [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 18 18 import { processedBlocks } from '../config/processedBlocks' 19 19 import { aMemoryLeakHasOccured } from './helpers' 20 import { ruleIncompatibilities } from '../config/ruleIncompatibilities' 21 import { getGlobalSettings } from './data' 20 22 21 23 const { getBlockName, getBlockAttributes } = select( 'core/block-editor' ) … … 96 98 97 99 } 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 */ 107 export 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 24 24 25 25 return globalSettings 26 27 } 28 29 /** 30 * Retrieves the localization management setting from the site entity. 31 * @returns {any} The localization management setting. 32 */ 33 export const getLocalizationManagementSetting = () => { 34 35 const siteEntity = getEntityRecord( 'root', 'site' ) 36 const localizationManagementSetting = siteEntity?.consistency_plugin_localization_management 37 38 return localizationManagementSetting 26 39 27 40 } -
consistency/tags/1.7.0/src/components/GlobalSettingPanel.js
r3122806 r3130518 10 10 */ 11 11 import { __ } from '@wordpress/i18n' 12 import { Panel, PanelHeader, PanelBody , PanelRow} from '@wordpress/components'12 import { Panel, PanelHeader, PanelBody } from '@wordpress/components' 13 13 14 14 /** 15 15 * External dependencies 16 16 */ 17 import { LocaleLabel } from './LocaleLabel' 17 18 import { GlobalSettingToggle } from './GlobalSettingToggle' 18 19 import { rules } from '../config/rules' … … 24 25 const GlobalSettingPanel = () => ( 25 26 <Panel className='GlobalSettingPanel'> 26 <PanelHeader><strong>{ __( 'Global correction rules', 'consistency' ) }</strong></PanelHeader> 27 <PanelHeader> 28 <strong>{ __( 'Global correction rules', 'consistency' ) }<LocaleLabel /></strong> 29 </PanelHeader> 27 30 { 28 31 [ ...categories ].map( ( cat, key ) => { -
consistency/tags/1.7.0/src/components/GlobalSettingToggle.js
r3086094 r3130518 19 19 */ 20 20 import { isUsedByLocale } from '../app/checks' 21 import { getLocalizationManagementSetting } from '../app/data' 22 import { checkRuleCompatibility } from '../app/checks' 21 23 22 24 export const GlobalSettingToggle = props => { 23 25 24 26 const { settingSlug, settingName, settingDescription } = props 27 const { createNotice } = useDispatch( noticesStore ) 25 28 26 if ( ! isUsedByLocale( settingSlug ) ) return ''29 if ( getLocalizationManagementSetting() && ! isUsedByLocale( settingSlug ) ) return '' 27 30 28 31 const [ settings, setSettings ] = useEntityProp( … … 34 37 35 38 const { saveEditedEntityRecord } = useDispatch( coreStore ) 36 const { createNotice } = useDispatch( noticesStore )37 39 38 40 const onSettingChanged = value => { … … 44 46 return obj 45 47 } ) 46 47 if ( ! newSettings?.find( x => x.slug === settingSlug ) ) {48 newSettings.push( { slug: settingSlug, value: value } )49 }50 48 51 49 setSettings( newSettings ) … … 59 57 { isDismissible: true, type: 'snackbar', speak: true } 60 58 ) 59 61 60 } 62 61 … … 67 66 help={ ( <span dangerouslySetInnerHTML={ settingDescription } /> ) } 68 67 checked={ settings?.find( x => x.slug === settingSlug )?.value || false } 68 disabled={ checkRuleCompatibility( settingSlug ) } 69 69 onChange={ onSettingChanged } 70 70 /> -
consistency/tags/1.7.0/src/components/UserSettingPanel.js
r3122806 r3130518 22 22 const UserSettingPanel = () => ( 23 23 <Panel className='UserSettingPanel'> 24 <PanelHeader><strong>{ __( 'Settings for my account', 'consistency' ) }</strong>< /PanelHeader>24 <PanelHeader><strong>{ __( 'Settings for my account', 'consistency' ) }</strong><br/></PanelHeader> 25 25 <div style={{ padding: 16 }}> 26 26 <PanelRow> -
consistency/tags/1.7.0/src/config/rules.js
r3122806 r3130518 13 13 export const rules = [ 14 14 { 15 // Replaces straight quote with curly quote15 // Replaces straight apostrophes with curly apostrophes 16 16 slug: 'quote', // slug of the setting and the related regex 17 name: __( 'Straight quote', 'consistency' ), // name of the setting18 description: __( 'Replace s straight quotes with curved quotes:', 'consistency' )17 name: __( 'Straight Apostrophe', 'consistency' ), // name of the setting 18 description: __( 'Replace straight apostrophes with curly apostrophes:', 'consistency' ) 19 19 + `<span aria-hidden='true' style='display:block;'><code>'</code> <span style='font-size:20px'>→</span> <code>’</code></span>`, // description of the setting 20 20 mask: /\'/, // mask … … 24 24 }, 25 25 { 26 // Replaces two hyphens with En dash26 // Replaces two hyphens with an En dash 27 27 slug: '2hyphens', 28 name: __( 'En dash', 'consistency' ),29 description: __( 'Replace s 2 hyphens with En dash:', 'consistency' )28 name: __( 'En Dash', 'consistency' ), 29 description: __( 'Replace two hyphens with an en dash:', 'consistency' ) 30 30 + `<span aria-hidden='true' style='display:block;'><code>--</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">–</code></span>`, 31 31 mask: /(?:\-)\-/, … … 37 37 // Replaces three hyphens with Em dash 38 38 slug: '3hyphens', 39 name: __( 'Em dash', 'consistency' ),40 description: __( 'Replace s 3 hyphens with Em dash:', 'consistency' )39 name: __( 'Em Dash', 'consistency' ), 40 description: __( 'Replace three hyphens with an em dash:', 'consistency' ) 41 41 + `<span aria-hidden='true' style='display:block;'><code>---</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">—</code></span>`, 42 42 mask: /(?:\–|\-\-)\-/, … … 49 49 }, 50 50 { 51 // Replaces four hyphens with Two-Em dash51 // Replaces four hyphens with two-em dash 52 52 slug: '4hyphens', 53 name: __( 'Two-Em dash', 'consistency' ),54 description: __( 'Replace s 4 hyphens with Two-Em dash:', 'consistency' )53 name: __( 'Two-Em Dash', 'consistency' ), 54 description: __( 'Replace four hyphens with two-em dash:', 'consistency' ) 55 55 + `<span aria-hidden='true' style='display:block;'><code>----</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">⸺</code></span>`, 56 56 mask: /(?:\—|\–\-|\-\-\-)\-/, … … 63 63 }, 64 64 { 65 // Add s HTML tag sup to ordinal number suffix65 // Add the sup HTML tag to ordinal number suffixes 66 66 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' ) 69 69 + `<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>`, 70 70 mask: /([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/, … … 74 74 }, 75 75 { 76 // Replaces regularquotes with curly quotes76 // Replaces straight quotes with curly quotes 77 77 slug: 'regularToCurlyQuotes', 78 name: __( 'Curly quotes', 'consistency' ),79 description: __( 'Replace s regularquotes with curly quotes:', 'consistency' )78 name: __( 'Curly Quotes', 'consistency' ), 79 description: __( 'Replace straight quotes with curly quotes:', 'consistency' ) 80 80 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>“ ”</code></span>`, 81 81 mask: /"/, // specific mask with specific process … … 85 85 }, 86 86 { 87 // Replaces regularquotes with german quotes87 // Replaces straight quotes with german quotes 88 88 slug: 'regularToGermanQuotes', 89 name: __( ' Regular quotes to german', 'consistency' ),90 description: __( 'Replace s regularquotes with german quotes:', 'consistency' )89 name: __( 'German Quotes', 'consistency' ), 90 description: __( 'Replace straight quotes with german quotes:', 'consistency' ) 91 91 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>„ “</code></span>`, 92 92 mask: /"/, // specific mask with specific process … … 96 96 }, 97 97 { 98 // Replaces regularquotes with german book-style quotes98 // Replaces straight quotes with german book-style quotes 99 99 slug: 'regularToGermanBookStyleQuotes', 100 name: __( ' Regular quotes to german book-style quotes', 'consistency' ),101 description: __( 'Replace s regularquotes with german book-style quotes:', 'consistency' )100 name: __( 'German Book-Style Quotes', 'consistency' ), 101 description: __( 'Replace straight quotes with german book-style quotes:', 'consistency' ) 102 102 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>» «</code></span>`, 103 103 mask: /"/, // specific mask with specific process … … 107 107 }, 108 108 { 109 // Replaces regularquotes with french quotes109 // Replaces straight quotes with french quotes 110 110 slug: 'regularToFrenchQuotes', 111 name: __( ' Regular quotes to french', 'consistency' ),112 description: __( 'Replace s 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' ) 113 113 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>« »</code></span>`, 114 114 mask: /"/, // specific mask with specific process … … 120 120 // Replaces regular quotes with french quotes without spaces 121 121 slug: 'regularToFrenchQuotesWithoutSpaces', 122 name: __( ' Regular quotes to french quotes without spaces', 'consistency' ),123 description: __( 'Replace s regularquotes with french quotes without spaces:', 'consistency' )122 name: __( 'French Quotes', 'consistency' ), 123 description: __( 'Replace straight quotes with french quotes without spaces:', 'consistency' ) 124 124 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>« »</code></span>`, 125 125 mask: /"/, // specific mask with specific process … … 131 131 // Replaces curly quotes with french quotes 132 132 slug: 'curlyToFrenchQuotes', 133 name: __( 'Curly quotes to french quotes', 'consistency' ),134 description: __( 'Replace s 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' ) 135 135 + `<span aria-hidden='true' style='display:block;'><code>“ ”</code> <span style='font-size:20px'>→</span> <code>« »</code></span>`, 136 136 mask: /“.*?”/, // specific mask with specific process … … 142 142 // Replaces a breaking space followed by a character from this list [? ! : ; » € $ £ ¥ ₽ 元 %] with a non-breaking space 143 143 slug: 'breakingSpace', 144 name: __( 'Breaking space', 'consistency' ),145 description: sprintf( __( 'Replace sa 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' ) 146 146 , `<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />` ), 147 147 mask: / ([\?|\!|\:|\;|\»|\€|\$|\£|\¥|\₽|\元|\%])/, … … 153 153 // Adds a non-breaking space before a character from this list [? ! : ; » € $ £ ¥ ₽ 元 %] having no space before 154 154 slug: 'noSpaceBefore', 155 name: __( 'No space before', 'consistency' ),156 description: sprintf( __( 'Add sa 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' ) 157 157 , `<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />` ), 158 158 mask: /(?<! | | )([\?|\!|\:|\»|\€|\$|\£|\¥|\₽|\元|\%])/, … … 164 164 // Removes any space preceding a character from this list [? ! : ; %] 165 165 slug: 'spaceBefore', 166 name: __( 'Space before', 'consistency' ),166 name: __( 'Space Before', 'consistency' ), 167 167 description: __( 'Remove any space preceding a character from this list:', 'consistency' ) 168 168 + `<span style='display:block;'><code>? ! : ; %</code></span>`, … … 175 175 // Adds a breaking space after a character from this list [, … ) ]] if this character is followed with another character except [, .] and a number 176 176 slug: 'noBreakingSpaceAfter', 177 name: __( 'No breaking space after', 'consistency' ),178 description: sprintf( __( 'Add sa 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' ) 179 179 , `<br /><code>, … ) ]</code><br />` ), 180 180 mask: /([\,|\…|\)|\]])(?! | |\.|\,|\d|$)(.)/, … … 186 186 // Adds a non-breaking space after [«] having no space after 187 187 slug: 'noNonBreakingSpaceAfter', 188 name: __( 'No non breaking space after', 'consistency' ),189 description: __( 'Add sa 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' ), 190 190 mask: /(«)(?! | | )/, 191 191 replace: '$1 ', … … 196 196 // Capitalize the first letter of a sentence 197 197 slug: 'capitalizeFirstSentenceLetter', 198 name: __( 'First sentence letter not capitalized', 'consistency' ),198 name: __( 'First Sentence Letter', 'consistency' ), 199 199 description: __( 'Capitalize the first letter of a sentence', 'consistency' ), 200 200 mask: /(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|\…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/, … … 206 206 // Replaces etc... with etc. 207 207 slug: 'etcThreeDots', 208 name: __( ' 3 dots following "etc"', 'consistency' ),209 description: __( 'Replace s 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' ) 210 210 + `<span aria-hidden='true' style='display:block;'><code>etc...</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`, 211 211 mask: /etc(\.{3})/i, … … 217 217 // Replaces etc.. with etc. 218 218 slug: 'etcTwoDots', 219 name: __( ' 2 dots following "etc"', 'consistency' ),220 description: __( 'Replace s 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' ) 221 221 + `<span aria-hidden='true' style='display:block;'><code>etc..</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`, 222 222 mask: /etc(\.{2})/i, … … 228 228 // Replaces etc… with etc. 229 229 slug: 'etcEllipsis', 230 name: __( 'Ellipsis following "etc"', 'consistency' ),231 description: __( 'Replace s 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' ) 232 232 + `<span aria-hidden='true' style='display:block;'><code>etc…</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`, 233 233 mask: /etc(\.{3}|…)/i, … … 250 250 // Replaces a character from this list [c p r] when enclosed in parentheses with a symbol 251 251 slug: 'symbolInACircle', 252 name: __( 'Symbol in a circle', 'consistency' ),252 name: __( 'Symbol in a Circle', 'consistency' ), 253 253 description: __( 'Replaces 1 character placed in parentheses with a symbol', 'consistency' ) 254 254 + `<span aria-hidden='true' style='display:block;'><code>(c) (p) (r)</code> <span style='font-size:20px'>→</span> <code>© ℗ ®</code></span>`, … … 271 271 // Replaces a character from this list [md tm mc sm] with a symbol in small caps and superscript style 272 272 slug: 'symbolInSmallCapsAndSuperscriptStyle', 273 name: __( 'Symbol in small caps and superscript style', 'consistency' ),273 name: __( 'Symbol in Small Caps and Superscript Style', 'consistency' ), 274 274 description: __( 'Replaces 2-character abbreviations with a symbol in small caps and superscript style', 'consistency' ) 275 275 + `<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:/(?<! | | )([\?|\!|\:|»|€|\$|£|¥|₽|元|\%])/,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:/(«)(?! | | )/,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(/ /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:/(?<! | | )([\?|\!|\:|»|€|\$|£|¥|₽|元|\%])/,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:/(«)(?! | | )/,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(/ /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 2 2 3 3 This 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 4 9 5 10 = 1.5.8 = -
consistency/trunk/consistency.php
r3125834 r3130518 4 4 * Plugin URI: https://www.webaxones.com 5 5 * Description: Fixes typographical consistency 6 * Version: 1. 6.56 * Version: 1.7.0 7 7 * Requires at least: 6.1 8 8 * Requires PHP: 7.4 -
consistency/trunk/includes/Config/RestSchema.php
r2857933 r3130518 10 10 { 11 11 /** 12 * Schema of Globalsettings in REST API12 * Schema of rules settings in REST API 13 13 * 14 * @var array $ globalSetting Schema of Global settings in REST API used in register_settings14 * @var array $ruleSettingSchema Schema of the setting in the REST API used in register_setting, which will contain the correction rules. 15 15 */ 16 public static array $ globalSetting= [16 public static array $ruleSettingSchema = [ 17 17 'items' => [ 18 18 'type' => 'object', … … 31 31 * Schema of User Meta Settings in REST API 32 32 * 33 * @var array $userMeta Schema of User Meta Settings in REST API used in register_meta33 * @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). 34 34 */ 35 public static array $userMeta = [35 public static array $userMetaSchema = [ 36 36 'items' => [ 37 37 'type' => 'object', -
consistency/trunk/includes/Config/UserSettings.php
r2857933 r3130518 26 26 'value' => true, 27 27 ], 28 [29 'slug' => 'on_selection',30 'value' => false,31 ],32 28 ]; 33 29 -
consistency/trunk/includes/MetaData/MetaData.php
r3122806 r3130518 87 87 88 88 /** 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. 90 93 * 91 94 * @return void 92 95 */ 93 public function setCurrentValue(): void96 public function fetchAndSetCurrentValue(): void 94 97 { 95 98 $this->currentValue = $this->get(); … … 109 112 public function add(): void 110 113 { 111 $this-> setCurrentValue();114 $this->fetchAndSetCurrentValue(); 112 115 113 116 if ( ! empty( $this->currentValue ) ) { -
consistency/trunk/includes/Option/Option.php
r2859754 r3130518 54 54 public function get() 55 55 { 56 return get_option( $this->optionName );56 return get_option( $this->optionName, null ); 57 57 } 58 58 … … 62 62 public function add(): void 63 63 { 64 if ( false!== $this->get() ) {64 if ( null !== $this->get() ) { 65 65 $this->update( $this->optionName, $this->get(), $this->value ); 66 66 } 67 67 68 if ( false=== $this->get() ) {68 if ( null === $this->get() ) { 69 69 add_option( $this->optionName, $this->value ); 70 70 } -
consistency/trunk/includes/Plugin.php
r3125834 r3130518 5 5 6 6 use Webaxones\Consistency\Config\Languages; 7 use Webaxones\Consistency\Config\LocalizationManagement; 7 8 use Webaxones\Consistency\Config\UserSettings; 8 9 use Webaxones\Consistency\Config\RestSchema; … … 32 33 protected static function setConstants(): void 33 34 { 34 defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1. 6.5' );35 defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.7.0' ); 35 36 defined( __NAMESPACE__ . '\PLUGIN_URL' ) || define( __NAMESPACE__ . '\PLUGIN_URL', plugin_dir_url( __DIR__ ) ); 36 37 defined( __NAMESPACE__ . '\PLUGIN_PATH' ) || define( __NAMESPACE__ . '\PLUGIN_PATH', plugin_dir_path( __DIR__ ) ); 37 38 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' ); 39 41 defined( __NAMESPACE__ . '\USER_SETTINGS_META_KEY' ) || define( __NAMESPACE__ . '\USER_SETTINGS_META_KEY', 'consistency_plugin_user_settings' ); 40 42 } … … 54 56 $hooks->register( $assets ); 55 57 56 // Register default global settings in main option depending onlanguage57 $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 ); 60 62 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 ); 64 77 65 78 // Get current user … … 73 86 74 87 // 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 ); 76 89 $hooks->register( $meta ); 77 90 -
consistency/trunk/includes/Setting/Setting.php
r2859754 r3130518 81 81 'sanitize_callback' => [ $this, 'sanitizeCallback' ], 82 82 ]; 83 83 84 register_setting( $this->optionGroup, $this->optionName, $args ); 84 85 } -
consistency/trunk/package.json
r3125834 r3130518 1 1 { 2 2 "name": "consistency", 3 "version": "1. 6.5",3 "version": "1.7.0", 4 4 "description": "", 5 5 "main": "index.js", -
consistency/trunk/readme.md
r3123688 r3130518 5 5 Fixes typographic errors when typing in the WordPress editor. 6 6 7 Do you seethe typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.7 Have 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. 8 8 9 9 See [WordPress directory page](https://wordpress.org/plugins/consistency/). … … 35 35 ## Description 36 36 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. 37 This WordPress plugin ensures consistent typography on your site. 38 38 39 > [!IMPORTANT] 39 40 > The corrections are automatic and are made during the entry as well as on a copy paste. … … 71 72 72 73 74 75 If 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 78 add_filter( 'Consistency\only_show_locale_correction_rules', '__return_false' ); 79 ``` 80 81 All 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 73 83 > [!TIP] 74 84 > **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 4 4 Requires at least: 6.1 5 5 Tested up to: 6.6 6 Stable tag: 1. 6.56 Stable tag: 1.7.0 7 7 Requires PHP: 7.4 8 8 License: GPL-3.0-or-later … … 13 13 == Description == 14 14 15 Do you seethe typographic corrector in your word processor that formats what you type in real time? Well, it's the same idea but with Gutenberg.15 Have 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. 16 16 17 This WordPress plugin is designed to help administrators enforce consistent typography in text content entered in the editor.17 This WordPress plugin ensures consistent typography on your site. 18 18 Corrections are applied automatically both during text entry and when pasting text. 19 Users can enable or disable autocorrect rules as needed. 19 20 All users can choose to enable or disable corrections, but only administrators can configure the correction rules. 20 21 Autocorrect is available for pages, posts, and custom post types (if they are configured to use the Rest API). 22 The 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. 21 23 22 Automatic fixes are listed on [the plugin repository on github](https://github.com/webaxones/consistency/).24 Pressing Ctrl+Z or Cmd+Z immediately after a correction disables the correction for the next keystroke. 23 25 26 == Technical Information == 24 27 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. 29 29 This data is deleted when the plugin is uninstalled. 30 30 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. 32 32 33 The locales supported by this plugin are:33 **Supported Locales**: The locales supported by this plugin are: 34 34 '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 36 If 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' );` 38 All 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). 35 39 36 40 == Screenshots == 37 41 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 42 1. 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. 43 2. Apostrophes 44 3. Quotation marks 45 4. Dashes 46 5. Suffixes 47 6. Spaces 48 7. Case 49 8. Ellipsis 50 9. Symbols 46 51 47 52 == Installation == … … 50 55 2. Configure the rules in the editor. 51 56 57 == Frequently Asked Questions == 58 59 = Does this plugin modify my content? = 60 61 Yes, 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 65 Absolutely not, since nothing is done on the front end. The processing only occurs when you enter content. 66 67 52 68 == 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 53 74 54 75 = 1.6.5 = … … 73 94 * Fix: Separate old changelog and new logs in 2 files 74 95 75 = 1.5.9 =76 * Add rule for percentages symbols77 * Refactor some code78 * Actualise Readme79 80 96 See [changelog.txt](https://plugins.svn.wordpress.org/consistency/trunk/changelog.txt) for older changelog -
consistency/trunk/src/app/checks.js
r3092549 r3130518 18 18 import { processedBlocks } from '../config/processedBlocks' 19 19 import { aMemoryLeakHasOccured } from './helpers' 20 import { ruleIncompatibilities } from '../config/ruleIncompatibilities' 21 import { getGlobalSettings } from './data' 20 22 21 23 const { getBlockName, getBlockAttributes } = select( 'core/block-editor' ) … … 96 98 97 99 } 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 */ 107 export 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 24 24 25 25 return globalSettings 26 27 } 28 29 /** 30 * Retrieves the localization management setting from the site entity. 31 * @returns {any} The localization management setting. 32 */ 33 export const getLocalizationManagementSetting = () => { 34 35 const siteEntity = getEntityRecord( 'root', 'site' ) 36 const localizationManagementSetting = siteEntity?.consistency_plugin_localization_management 37 38 return localizationManagementSetting 26 39 27 40 } -
consistency/trunk/src/components/GlobalSettingPanel.js
r3122806 r3130518 10 10 */ 11 11 import { __ } from '@wordpress/i18n' 12 import { Panel, PanelHeader, PanelBody , PanelRow} from '@wordpress/components'12 import { Panel, PanelHeader, PanelBody } from '@wordpress/components' 13 13 14 14 /** 15 15 * External dependencies 16 16 */ 17 import { LocaleLabel } from './LocaleLabel' 17 18 import { GlobalSettingToggle } from './GlobalSettingToggle' 18 19 import { rules } from '../config/rules' … … 24 25 const GlobalSettingPanel = () => ( 25 26 <Panel className='GlobalSettingPanel'> 26 <PanelHeader><strong>{ __( 'Global correction rules', 'consistency' ) }</strong></PanelHeader> 27 <PanelHeader> 28 <strong>{ __( 'Global correction rules', 'consistency' ) }<LocaleLabel /></strong> 29 </PanelHeader> 27 30 { 28 31 [ ...categories ].map( ( cat, key ) => { -
consistency/trunk/src/components/GlobalSettingToggle.js
r3086094 r3130518 19 19 */ 20 20 import { isUsedByLocale } from '../app/checks' 21 import { getLocalizationManagementSetting } from '../app/data' 22 import { checkRuleCompatibility } from '../app/checks' 21 23 22 24 export const GlobalSettingToggle = props => { 23 25 24 26 const { settingSlug, settingName, settingDescription } = props 27 const { createNotice } = useDispatch( noticesStore ) 25 28 26 if ( ! isUsedByLocale( settingSlug ) ) return ''29 if ( getLocalizationManagementSetting() && ! isUsedByLocale( settingSlug ) ) return '' 27 30 28 31 const [ settings, setSettings ] = useEntityProp( … … 34 37 35 38 const { saveEditedEntityRecord } = useDispatch( coreStore ) 36 const { createNotice } = useDispatch( noticesStore )37 39 38 40 const onSettingChanged = value => { … … 44 46 return obj 45 47 } ) 46 47 if ( ! newSettings?.find( x => x.slug === settingSlug ) ) {48 newSettings.push( { slug: settingSlug, value: value } )49 }50 48 51 49 setSettings( newSettings ) … … 59 57 { isDismissible: true, type: 'snackbar', speak: true } 60 58 ) 59 61 60 } 62 61 … … 67 66 help={ ( <span dangerouslySetInnerHTML={ settingDescription } /> ) } 68 67 checked={ settings?.find( x => x.slug === settingSlug )?.value || false } 68 disabled={ checkRuleCompatibility( settingSlug ) } 69 69 onChange={ onSettingChanged } 70 70 /> -
consistency/trunk/src/components/UserSettingPanel.js
r3122806 r3130518 22 22 const UserSettingPanel = () => ( 23 23 <Panel className='UserSettingPanel'> 24 <PanelHeader><strong>{ __( 'Settings for my account', 'consistency' ) }</strong>< /PanelHeader>24 <PanelHeader><strong>{ __( 'Settings for my account', 'consistency' ) }</strong><br/></PanelHeader> 25 25 <div style={{ padding: 16 }}> 26 26 <PanelRow> -
consistency/trunk/src/config/rules.js
r3122806 r3130518 13 13 export const rules = [ 14 14 { 15 // Replaces straight quote with curly quote15 // Replaces straight apostrophes with curly apostrophes 16 16 slug: 'quote', // slug of the setting and the related regex 17 name: __( 'Straight quote', 'consistency' ), // name of the setting18 description: __( 'Replace s straight quotes with curved quotes:', 'consistency' )17 name: __( 'Straight Apostrophe', 'consistency' ), // name of the setting 18 description: __( 'Replace straight apostrophes with curly apostrophes:', 'consistency' ) 19 19 + `<span aria-hidden='true' style='display:block;'><code>'</code> <span style='font-size:20px'>→</span> <code>’</code></span>`, // description of the setting 20 20 mask: /\'/, // mask … … 24 24 }, 25 25 { 26 // Replaces two hyphens with En dash26 // Replaces two hyphens with an En dash 27 27 slug: '2hyphens', 28 name: __( 'En dash', 'consistency' ),29 description: __( 'Replace s 2 hyphens with En dash:', 'consistency' )28 name: __( 'En Dash', 'consistency' ), 29 description: __( 'Replace two hyphens with an en dash:', 'consistency' ) 30 30 + `<span aria-hidden='true' style='display:block;'><code>--</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">–</code></span>`, 31 31 mask: /(?:\-)\-/, … … 37 37 // Replaces three hyphens with Em dash 38 38 slug: '3hyphens', 39 name: __( 'Em dash', 'consistency' ),40 description: __( 'Replace s 3 hyphens with Em dash:', 'consistency' )39 name: __( 'Em Dash', 'consistency' ), 40 description: __( 'Replace three hyphens with an em dash:', 'consistency' ) 41 41 + `<span aria-hidden='true' style='display:block;'><code>---</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">—</code></span>`, 42 42 mask: /(?:\–|\-\-)\-/, … … 49 49 }, 50 50 { 51 // Replaces four hyphens with Two-Em dash51 // Replaces four hyphens with two-em dash 52 52 slug: '4hyphens', 53 name: __( 'Two-Em dash', 'consistency' ),54 description: __( 'Replace s 4 hyphens with Two-Em dash:', 'consistency' )53 name: __( 'Two-Em Dash', 'consistency' ), 54 description: __( 'Replace four hyphens with two-em dash:', 'consistency' ) 55 55 + `<span aria-hidden='true' style='display:block;'><code>----</code> <span style='font-size:20px'>→</span> <code style="font-family:sans-serif;">⸺</code></span>`, 56 56 mask: /(?:\—|\–\-|\-\-\-)\-/, … … 63 63 }, 64 64 { 65 // Add s HTML tag sup to ordinal number suffix65 // Add the sup HTML tag to ordinal number suffixes 66 66 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' ) 69 69 + `<span aria-hidden='true' style='display:block;'><code>1st</code> <span style='font-size:20px'>→</span> <code>1<sup>st</sup></code></span>`, 70 70 mask: /([10-9]{1,20})(th|nd|rd|e|er|res|d|ds|de|des)( | |\.|\,|\;)/, … … 74 74 }, 75 75 { 76 // Replaces regularquotes with curly quotes76 // Replaces straight quotes with curly quotes 77 77 slug: 'regularToCurlyQuotes', 78 name: __( 'Curly quotes', 'consistency' ),79 description: __( 'Replace s regularquotes with curly quotes:', 'consistency' )78 name: __( 'Curly Quotes', 'consistency' ), 79 description: __( 'Replace straight quotes with curly quotes:', 'consistency' ) 80 80 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>“ ”</code></span>`, 81 81 mask: /"/, // specific mask with specific process … … 85 85 }, 86 86 { 87 // Replaces regularquotes with german quotes87 // Replaces straight quotes with german quotes 88 88 slug: 'regularToGermanQuotes', 89 name: __( ' Regular quotes to german', 'consistency' ),90 description: __( 'Replace s regularquotes with german quotes:', 'consistency' )89 name: __( 'German Quotes', 'consistency' ), 90 description: __( 'Replace straight quotes with german quotes:', 'consistency' ) 91 91 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>„ “</code></span>`, 92 92 mask: /"/, // specific mask with specific process … … 96 96 }, 97 97 { 98 // Replaces regularquotes with german book-style quotes98 // Replaces straight quotes with german book-style quotes 99 99 slug: 'regularToGermanBookStyleQuotes', 100 name: __( ' Regular quotes to german book-style quotes', 'consistency' ),101 description: __( 'Replace s regularquotes with german book-style quotes:', 'consistency' )100 name: __( 'German Book-Style Quotes', 'consistency' ), 101 description: __( 'Replace straight quotes with german book-style quotes:', 'consistency' ) 102 102 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>» «</code></span>`, 103 103 mask: /"/, // specific mask with specific process … … 107 107 }, 108 108 { 109 // Replaces regularquotes with french quotes109 // Replaces straight quotes with french quotes 110 110 slug: 'regularToFrenchQuotes', 111 name: __( ' Regular quotes to french', 'consistency' ),112 description: __( 'Replace s 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' ) 113 113 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>« »</code></span>`, 114 114 mask: /"/, // specific mask with specific process … … 120 120 // Replaces regular quotes with french quotes without spaces 121 121 slug: 'regularToFrenchQuotesWithoutSpaces', 122 name: __( ' Regular quotes to french quotes without spaces', 'consistency' ),123 description: __( 'Replace s regularquotes with french quotes without spaces:', 'consistency' )122 name: __( 'French Quotes', 'consistency' ), 123 description: __( 'Replace straight quotes with french quotes without spaces:', 'consistency' ) 124 124 + `<span aria-hidden='true' style='display:block;'><code>" "</code> <span style='font-size:20px'>→</span> <code>« »</code></span>`, 125 125 mask: /"/, // specific mask with specific process … … 131 131 // Replaces curly quotes with french quotes 132 132 slug: 'curlyToFrenchQuotes', 133 name: __( 'Curly quotes to french quotes', 'consistency' ),134 description: __( 'Replace s 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' ) 135 135 + `<span aria-hidden='true' style='display:block;'><code>“ ”</code> <span style='font-size:20px'>→</span> <code>« »</code></span>`, 136 136 mask: /“.*?”/, // specific mask with specific process … … 142 142 // Replaces a breaking space followed by a character from this list [? ! : ; » € $ £ ¥ ₽ 元 %] with a non-breaking space 143 143 slug: 'breakingSpace', 144 name: __( 'Breaking space', 'consistency' ),145 description: sprintf( __( 'Replace sa 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' ) 146 146 , `<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />` ), 147 147 mask: / ([\?|\!|\:|\;|\»|\€|\$|\£|\¥|\₽|\元|\%])/, … … 153 153 // Adds a non-breaking space before a character from this list [? ! : ; » € $ £ ¥ ₽ 元 %] having no space before 154 154 slug: 'noSpaceBefore', 155 name: __( 'No space before', 'consistency' ),156 description: sprintf( __( 'Add sa 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' ) 157 157 , `<br /><code>? ! : ; » € $ £ ¥ ₽ 元 %</code><br />` ), 158 158 mask: /(?<! | | )([\?|\!|\:|\»|\€|\$|\£|\¥|\₽|\元|\%])/, … … 164 164 // Removes any space preceding a character from this list [? ! : ; %] 165 165 slug: 'spaceBefore', 166 name: __( 'Space before', 'consistency' ),166 name: __( 'Space Before', 'consistency' ), 167 167 description: __( 'Remove any space preceding a character from this list:', 'consistency' ) 168 168 + `<span style='display:block;'><code>? ! : ; %</code></span>`, … … 175 175 // Adds a breaking space after a character from this list [, … ) ]] if this character is followed with another character except [, .] and a number 176 176 slug: 'noBreakingSpaceAfter', 177 name: __( 'No breaking space after', 'consistency' ),178 description: sprintf( __( 'Add sa 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' ) 179 179 , `<br /><code>, … ) ]</code><br />` ), 180 180 mask: /([\,|\…|\)|\]])(?! | |\.|\,|\d|$)(.)/, … … 186 186 // Adds a non-breaking space after [«] having no space after 187 187 slug: 'noNonBreakingSpaceAfter', 188 name: __( 'No non breaking space after', 'consistency' ),189 description: __( 'Add sa 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' ), 190 190 mask: /(«)(?! | | )/, 191 191 replace: '$1 ', … … 196 196 // Capitalize the first letter of a sentence 197 197 slug: 'capitalizeFirstSentenceLetter', 198 name: __( 'First sentence letter not capitalized', 'consistency' ),198 name: __( 'First Sentence Letter', 'consistency' ), 199 199 description: __( 'Capitalize the first letter of a sentence', 'consistency' ), 200 200 mask: /(^[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț])|(?<=[\.|\?|\!|\…] )[a-záàâäãåăçéèêëíìîïñóòôöõúùûüýÿæœșț]/, … … 206 206 // Replaces etc... with etc. 207 207 slug: 'etcThreeDots', 208 name: __( ' 3 dots following "etc"', 'consistency' ),209 description: __( 'Replace s 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' ) 210 210 + `<span aria-hidden='true' style='display:block;'><code>etc...</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`, 211 211 mask: /etc(\.{3})/i, … … 217 217 // Replaces etc.. with etc. 218 218 slug: 'etcTwoDots', 219 name: __( ' 2 dots following "etc"', 'consistency' ),220 description: __( 'Replace s 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' ) 221 221 + `<span aria-hidden='true' style='display:block;'><code>etc..</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`, 222 222 mask: /etc(\.{2})/i, … … 228 228 // Replaces etc… with etc. 229 229 slug: 'etcEllipsis', 230 name: __( 'Ellipsis following "etc"', 'consistency' ),231 description: __( 'Replace s 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' ) 232 232 + `<span aria-hidden='true' style='display:block;'><code>etc…</code> <span style='font-size:20px'>→</span> <code>etc.</code></span>`, 233 233 mask: /etc(\.{3}|…)/i, … … 250 250 // Replaces a character from this list [c p r] when enclosed in parentheses with a symbol 251 251 slug: 'symbolInACircle', 252 name: __( 'Symbol in a circle', 'consistency' ),252 name: __( 'Symbol in a Circle', 'consistency' ), 253 253 description: __( 'Replaces 1 character placed in parentheses with a symbol', 'consistency' ) 254 254 + `<span aria-hidden='true' style='display:block;'><code>(c) (p) (r)</code> <span style='font-size:20px'>→</span> <code>© ℗ ®</code></span>`, … … 271 271 // Replaces a character from this list [md tm mc sm] with a symbol in small caps and superscript style 272 272 slug: 'symbolInSmallCapsAndSuperscriptStyle', 273 name: __( 'Symbol in small caps and superscript style', 'consistency' ),273 name: __( 'Symbol in Small Caps and Superscript Style', 'consistency' ), 274 274 description: __( 'Replaces 2-character abbreviations with a symbol in small caps and superscript style', 'consistency' ) 275 275 + `<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.