auto-component 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.jsx +16 -16
package/package.json
CHANGED
package/src/index.jsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react'
|
|
2
2
|
// import beautify from 'js-beautify';
|
|
3
|
-
import beautify from './node_modules/js-beautify/js/lib/beautify.js';
|
|
4
3
|
import './auto-component.css'
|
|
5
4
|
|
|
6
5
|
const AutoComponent = ({ exclusions }) => {
|
|
@@ -35,13 +34,13 @@ const AutoComponent = ({ exclusions }) => {
|
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
// format html for display (breaks/indentation)
|
|
38
|
-
const formatHtml = (html) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
37
|
+
// const formatHtml = (html) => {
|
|
38
|
+
// return beautify.html(html, {
|
|
39
|
+
// indent_size: 2,
|
|
40
|
+
// wrap_line_length: 80,
|
|
41
|
+
// max_preserve_newlines: 1,
|
|
42
|
+
// })
|
|
43
|
+
// }
|
|
45
44
|
|
|
46
45
|
// clean html of exclusions:
|
|
47
46
|
// if an element className includes 'exclude'
|
|
@@ -59,13 +58,13 @@ const AutoComponent = ({ exclusions }) => {
|
|
|
59
58
|
};
|
|
60
59
|
|
|
61
60
|
// full exclusion
|
|
62
|
-
const cleanExclusionsFull = (html) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
61
|
+
// const cleanExclusionsFull = (html) => {
|
|
62
|
+
// const regexExcludeClass = /<[^>]*\sclass\s*=\s*['"]([^'"]*exclude[^'"]*)['"][^>]*>[\s\S]*?<\/[^>]*>/g
|
|
63
|
+
// const cleanedHtml = html.replace(regexExcludeClass, '')
|
|
64
|
+
// const scriptIndex = cleanedHtml.lastIndexOf('<script')
|
|
65
|
+
//
|
|
66
|
+
// return formatHtml(cleanedHtml.substring(0, scriptIndex))
|
|
67
|
+
// }
|
|
69
68
|
|
|
70
69
|
// exclude non <style> data and remove comments
|
|
71
70
|
const cleanStyles = (css) => {
|
|
@@ -126,7 +125,8 @@ const AutoComponent = ({ exclusions }) => {
|
|
|
126
125
|
const resData = await sendRequest();
|
|
127
126
|
|
|
128
127
|
if (resData) {
|
|
129
|
-
setResponseData(formatHtml(resData.response.content));
|
|
128
|
+
// setResponseData(formatHtml(resData.response.content));
|
|
129
|
+
setResponseData(resData.response.content);
|
|
130
130
|
setActiveTab('response');
|
|
131
131
|
}
|
|
132
132
|
} catch (err) {
|