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 / blocks / code-snippet-tab / src / attributes.js

attributes.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/gutenberg/blocks/code-snippet-tab/src/attributes.js

132 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {
2 CODE_SNIPPET_WRAPPER_MARGIN,
3 CODE_SNIPPET_WRAPPER_PADDING,
4 CODE_SNIPPET_HEADER_PADDING,
5 CODE_SNIPPET_LINE_NUMBERS_PADDING,
6 CODE_SNIPPET_CODE_PADDING,
7 } from '../../code-snippet/src/constants';
8
9 import {
10 generateTypographyAttributes,
11 generateDimensionsAttributes,
12 } from '../../../util/helpers';
13
14 import * as prefixes from '../../code-snippet/src/typographyPrefixConstants';
15
16 const attributes = {
17 // Required attributes for responsive options and asset generation
18 resOption: {
19 type: 'string',
20 default: 'Desktop',
21 },
22 blockId: {
23 type: 'string',
24 },
25 blockRoot: {
26 type: 'string',
27 default: 'better_docs',
28 },
29 blockMeta: {
30 type: 'object',
31 },
32
33 // Content: one entry per HTTP status → a tab. { status, language, codeContent }.
34 responses: {
35 type: 'array',
36 default: [
37 { status: '200', language: 'json', codeContent: '{\n "success": true\n}' },
38 ],
39 },
40
41 showCopyButton: {
42 type: 'boolean',
43 default: true,
44 },
45 showHeader: {
46 type: 'boolean',
47 default: true,
48 },
49 showLineNumbers: {
50 type: 'boolean',
51 default: false,
52 },
53 theme: {
54 type: 'string',
55 default: 'light',
56 },
57
58 // Typography attributes (shared with Code Snippet)
59 ...generateTypographyAttributes(Object.values(prefixes)),
60
61 // Color / border attributes (reuse the Code Snippet style machinery)
62 lineNumberColor: {
63 type: 'string',
64 default: null,
65 },
66 lineNumberBgColor: {
67 type: 'string',
68 default: null,
69 },
70 lineNumberBorderColor: {
71 type: 'string',
72 default: null,
73 },
74 lineNumberBorderWidth: {
75 type: 'number',
76 default: 1,
77 },
78 wrapperBackgroundColor: {
79 type: 'string',
80 default: null,
81 },
82 wrapperBorderColor: {
83 type: 'string',
84 default: null,
85 },
86 wrapperBorderWidth: {
87 type: 'number',
88 default: 0,
89 },
90 wrapperBorderRadius: {
91 type: 'number',
92 default: 0,
93 },
94 headerBackgroundColor: {
95 type: 'string',
96 default: null,
97 },
98 headerBorderColor: {
99 type: 'string',
100 default: null,
101 },
102 headerBorderWidth: {
103 type: 'number',
104 default: 1,
105 },
106 fileNameColor: {
107 type: 'string',
108 default: null,
109 },
110 copyButtonColor: {
111 type: 'string',
112 default: null,
113 },
114 copyButtonBorderColor: {
115 type: 'string',
116 default: null,
117 },
118 codeBackgroundColor: {
119 type: 'string',
120 default: null,
121 },
122
123 // Dimension attributes with null defaults for responsive consistency
124 ...generateDimensionsAttributes(CODE_SNIPPET_WRAPPER_MARGIN),
125 ...generateDimensionsAttributes(CODE_SNIPPET_WRAPPER_PADDING),
126 ...generateDimensionsAttributes(CODE_SNIPPET_HEADER_PADDING),
127 ...generateDimensionsAttributes(CODE_SNIPPET_LINE_NUMBERS_PADDING),
128 ...generateDimensionsAttributes(CODE_SNIPPET_CODE_PADDING),
129 };
130
131 export default attributes;
132