PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / gutenberg / util / helpers / miniHelperFuncs.js

miniHelperFuncs.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/gutenberg/util/helpers/miniHelperFuncs.js

32 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // helper Functions: function 'textInsideForEdit' is for setting the innertext depending on whether separator should be shown and which separator should be shown in the number-counter block
2 export const textInsideForEdit = (value, isShowSeparator, separator) =>
3 isShowSeparator
4 ? value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator)
5 : value.toString();
6
7 // generateRandomNumber function is for generating a random number
8 export const generateRandomNumber = () =>
9 Math.floor(Math.random() * 1000000000);
10
11 // hardMinifyCssStrings is for minifying the css which is in the style tag as a string for view.js
12 export const hardMinifyCssStrings = (cssString) => {
13 return (
14 cssString
15 .replace(/\s+/g, " ")
16 .replace(/(?<=\:).+(?=\;)/g, function (match) {
17 return match.trim().replace(/\s+/g, "__s_p_a_c_e__");
18 })
19 // .replace(/\s+(?!(?:[\w\d\.\-\#]+\{))/g, "")
20 .replace(/\s+(?![\w\d\.\-\#]+\{)/g, "")
21 .replace(/\s+/g, " ")
22 .replace(/__s_p_a_c_e__/g, " ")
23 );
24 };
25
26 // softMinifyCssStrings is for minifying the css which is in the style tag as a string for view.js
27 export const softMinifyCssStrings = (cssString = " ") => cssString .replace(/\s+/g, " ") .replace(/\.eb\-[\w\-\s\.\,\:\>\=\"\'\(\)\d\+\[\]\#\>]+\{[\s]+\}/g, "");
28
29 // check if css string is empty or not.
30 export const isCssExists = (cssString) =>
31 /.+(?=\:(?!hover)(?!focus))/.test(cssString);
32