| 1 |
{ |
| 2 |
"$schema": "https://schemas.wp.org/trunk/block.json", |
| 3 |
"apiVersion": 3, |
| 4 |
"name": "b-blocks/code-highlight", |
| 5 |
"title": "Code Highlight", |
| 6 |
"category": "bBlocks", |
| 7 |
"description": "Show a syntax-highlighted code snippet with themes, line numbers and a copy button.", |
| 8 |
"keywords": [ |
| 9 |
"code", |
| 10 |
"snippet", |
| 11 |
"syntax", |
| 12 |
"highlight", |
| 13 |
"prism", |
| 14 |
"pre" |
| 15 |
], |
| 16 |
"textdomain": "b-blocks", |
| 17 |
"supports": { |
| 18 |
"html": false, |
| 19 |
"align": [ |
| 20 |
"wide", |
| 21 |
"full" |
| 22 |
] |
| 23 |
}, |
| 24 |
"attributes": { |
| 25 |
"blockId": { |
| 26 |
"type": "string", |
| 27 |
"default": "" |
| 28 |
}, |
| 29 |
"align": { |
| 30 |
"type": "string", |
| 31 |
"default": "" |
| 32 |
}, |
| 33 |
"content": { |
| 34 |
"type": "object", |
| 35 |
"default": { |
| 36 |
"code": "function greet(name) {\n\tconsole.log(`Hello, ${name}!`);\n}\n\ngreet('World');", |
| 37 |
"language": "javascript", |
| 38 |
"filename": "example.js", |
| 39 |
"caption": "" |
| 40 |
} |
| 41 |
}, |
| 42 |
"options": { |
| 43 |
"type": "object", |
| 44 |
"default": { |
| 45 |
"header": true, |
| 46 |
"showLanguage": false, |
| 47 |
"windowDots": false, |
| 48 |
"lineNumbers": true, |
| 49 |
"startLine": 1, |
| 50 |
"highlightLines": "", |
| 51 |
"wordWrap": false, |
| 52 |
"tabSize": 2, |
| 53 |
"maxLines": 0, |
| 54 |
"collapsible": false, |
| 55 |
"expandLabel": "Show all", |
| 56 |
"collapseLabel": "Show less", |
| 57 |
"copyButton": true, |
| 58 |
"copyPosition": "header", |
| 59 |
"copyLabel": "Copy", |
| 60 |
"copiedLabel": "Copied!", |
| 61 |
"captionPosition": "bottom" |
| 62 |
} |
| 63 |
}, |
| 64 |
"theme": { |
| 65 |
"type": "string", |
| 66 |
"default": "porple" |
| 67 |
}, |
| 68 |
"box": { |
| 69 |
"type": "object", |
| 70 |
"default": { |
| 71 |
"desktop": { |
| 72 |
"align": "center", |
| 73 |
"width": "100%", |
| 74 |
"height": "", |
| 75 |
"padding": { |
| 76 |
"top": "", |
| 77 |
"right": "", |
| 78 |
"bottom": "", |
| 79 |
"left": "" |
| 80 |
}, |
| 81 |
"radius": { |
| 82 |
"top": "", |
| 83 |
"right": "", |
| 84 |
"bottom": "", |
| 85 |
"left": "" |
| 86 |
} |
| 87 |
}, |
| 88 |
"tablet": { |
| 89 |
"align": "", |
| 90 |
"width": "", |
| 91 |
"height": "", |
| 92 |
"padding": { |
| 93 |
"top": "", |
| 94 |
"right": "", |
| 95 |
"bottom": "", |
| 96 |
"left": "" |
| 97 |
}, |
| 98 |
"radius": { |
| 99 |
"top": "", |
| 100 |
"right": "", |
| 101 |
"bottom": "", |
| 102 |
"left": "" |
| 103 |
} |
| 104 |
}, |
| 105 |
"mobile": { |
| 106 |
"align": "", |
| 107 |
"width": "", |
| 108 |
"height": "", |
| 109 |
"padding": { |
| 110 |
"top": "", |
| 111 |
"right": "", |
| 112 |
"bottom": "", |
| 113 |
"left": "" |
| 114 |
}, |
| 115 |
"radius": { |
| 116 |
"top": "", |
| 117 |
"right": "", |
| 118 |
"bottom": "", |
| 119 |
"left": "" |
| 120 |
} |
| 121 |
}, |
| 122 |
"background": {}, |
| 123 |
"border": {}, |
| 124 |
"shadow": { |
| 125 |
"normal": [], |
| 126 |
"hover": [] |
| 127 |
} |
| 128 |
} |
| 129 |
}, |
| 130 |
"codeTypo": { |
| 131 |
"type": "object", |
| 132 |
"default": { |
| 133 |
"fontSize": { |
| 134 |
"desktop": 15, |
| 135 |
"tablet": 14, |
| 136 |
"mobile": 13 |
| 137 |
} |
| 138 |
} |
| 139 |
}, |
| 140 |
"headerStyle": { |
| 141 |
"type": "object", |
| 142 |
"default": { |
| 143 |
"background": {}, |
| 144 |
"filenameColor": "", |
| 145 |
"filenameTypo": { |
| 146 |
"fontSize": { |
| 147 |
"desktop": 12, |
| 148 |
"tablet": "", |
| 149 |
"mobile": "" |
| 150 |
} |
| 151 |
}, |
| 152 |
"badgeColor": "", |
| 153 |
"badgeBackground": {} |
| 154 |
} |
| 155 |
}, |
| 156 |
"lineNumber": { |
| 157 |
"type": "object", |
| 158 |
"default": { |
| 159 |
"color": "", |
| 160 |
"background": {}, |
| 161 |
"borderColor": "" |
| 162 |
} |
| 163 |
}, |
| 164 |
"highlight": { |
| 165 |
"type": "object", |
| 166 |
"default": { |
| 167 |
"background": {}, |
| 168 |
"borderColor": "" |
| 169 |
} |
| 170 |
}, |
| 171 |
"copyBtn": { |
| 172 |
"type": "object", |
| 173 |
"default": { |
| 174 |
"normal": { |
| 175 |
"color": "", |
| 176 |
"background": {}, |
| 177 |
"border": {} |
| 178 |
}, |
| 179 |
"hover": { |
| 180 |
"color": "", |
| 181 |
"background": {}, |
| 182 |
"border": {} |
| 183 |
}, |
| 184 |
"copied": { |
| 185 |
"color": "", |
| 186 |
"background": {}, |
| 187 |
"border": {} |
| 188 |
}, |
| 189 |
"typo": { |
| 190 |
"fontSize": { |
| 191 |
"desktop": 12, |
| 192 |
"tablet": "", |
| 193 |
"mobile": "" |
| 194 |
} |
| 195 |
}, |
| 196 |
"padding": { |
| 197 |
"top": "", |
| 198 |
"right": "", |
| 199 |
"bottom": "", |
| 200 |
"left": "" |
| 201 |
}, |
| 202 |
"radius": { |
| 203 |
"top": "", |
| 204 |
"right": "", |
| 205 |
"bottom": "", |
| 206 |
"left": "" |
| 207 |
} |
| 208 |
} |
| 209 |
}, |
| 210 |
"buttonIcon": { |
| 211 |
"type": "object", |
| 212 |
"default": { |
| 213 |
"enable": true, |
| 214 |
"icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='9' width='13' height='13' rx='2'></rect><path d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'></path></svg>", |
| 215 |
"position": "left", |
| 216 |
"size": "13px", |
| 217 |
"spacing": "6px", |
| 218 |
"desktop": { |
| 219 |
"padding": { |
| 220 |
"top": "", |
| 221 |
"right": "", |
| 222 |
"bottom": "", |
| 223 |
"left": "" |
| 224 |
}, |
| 225 |
"margin": { |
| 226 |
"top": "", |
| 227 |
"right": "", |
| 228 |
"bottom": "", |
| 229 |
"left": "" |
| 230 |
}, |
| 231 |
"radius": { |
| 232 |
"top": "", |
| 233 |
"right": "", |
| 234 |
"bottom": "", |
| 235 |
"left": "" |
| 236 |
} |
| 237 |
}, |
| 238 |
"tablet": { |
| 239 |
"padding": { |
| 240 |
"top": "", |
| 241 |
"right": "", |
| 242 |
"bottom": "", |
| 243 |
"left": "" |
| 244 |
}, |
| 245 |
"margin": { |
| 246 |
"top": "", |
| 247 |
"right": "", |
| 248 |
"bottom": "", |
| 249 |
"left": "" |
| 250 |
}, |
| 251 |
"radius": { |
| 252 |
"top": "", |
| 253 |
"right": "", |
| 254 |
"bottom": "", |
| 255 |
"left": "" |
| 256 |
} |
| 257 |
}, |
| 258 |
"mobile": { |
| 259 |
"padding": { |
| 260 |
"top": "", |
| 261 |
"right": "", |
| 262 |
"bottom": "", |
| 263 |
"left": "" |
| 264 |
}, |
| 265 |
"margin": { |
| 266 |
"top": "", |
| 267 |
"right": "", |
| 268 |
"bottom": "", |
| 269 |
"left": "" |
| 270 |
}, |
| 271 |
"radius": { |
| 272 |
"top": "", |
| 273 |
"right": "", |
| 274 |
"bottom": "", |
| 275 |
"left": "" |
| 276 |
} |
| 277 |
}, |
| 278 |
"normal": { |
| 279 |
"color": "", |
| 280 |
"background": {}, |
| 281 |
"border": {}, |
| 282 |
"rotate": "0deg" |
| 283 |
}, |
| 284 |
"hover": { |
| 285 |
"color": "", |
| 286 |
"background": {}, |
| 287 |
"border": {}, |
| 288 |
"rotate": "0deg" |
| 289 |
} |
| 290 |
} |
| 291 |
}, |
| 292 |
"caption": { |
| 293 |
"type": "object", |
| 294 |
"default": { |
| 295 |
"color": "", |
| 296 |
"typo": { |
| 297 |
"fontSize": { |
| 298 |
"desktop": 13, |
| 299 |
"tablet": "", |
| 300 |
"mobile": "" |
| 301 |
} |
| 302 |
}, |
| 303 |
"align": "center" |
| 304 |
} |
| 305 |
}, |
| 306 |
"advanced": { |
| 307 |
"type": "object", |
| 308 |
"default": { |
| 309 |
"dimension": { |
| 310 |
"padding": { |
| 311 |
"desktop": { |
| 312 |
"top": "", |
| 313 |
"right": "", |
| 314 |
"bottom": "", |
| 315 |
"left": "" |
| 316 |
}, |
| 317 |
"tablet": { |
| 318 |
"top": "", |
| 319 |
"right": "", |
| 320 |
"bottom": "", |
| 321 |
"left": "" |
| 322 |
}, |
| 323 |
"mobile": { |
| 324 |
"top": "", |
| 325 |
"right": "", |
| 326 |
"bottom": "", |
| 327 |
"left": "" |
| 328 |
} |
| 329 |
} |
| 330 |
}, |
| 331 |
"transform": { |
| 332 |
"normal": { |
| 333 |
"rotate": { |
| 334 |
"desktop": { |
| 335 |
"z": "", |
| 336 |
"y": "", |
| 337 |
"x": "" |
| 338 |
}, |
| 339 |
"tablet": { |
| 340 |
"z": "", |
| 341 |
"y": "", |
| 342 |
"x": "" |
| 343 |
}, |
| 344 |
"mobile": { |
| 345 |
"z": "", |
| 346 |
"y": "", |
| 347 |
"x": "" |
| 348 |
}, |
| 349 |
"threeDRotate": false |
| 350 |
}, |
| 351 |
"offset": { |
| 352 |
"desktop": { |
| 353 |
"x": "", |
| 354 |
"y": "" |
| 355 |
}, |
| 356 |
"tablet": { |
| 357 |
"x": "", |
| 358 |
"y": "" |
| 359 |
}, |
| 360 |
"mobile": { |
| 361 |
"x": "", |
| 362 |
"y": "" |
| 363 |
} |
| 364 |
}, |
| 365 |
"scale": { |
| 366 |
"isProportion": true, |
| 367 |
"desktop": { |
| 368 |
"x": "", |
| 369 |
"y": "", |
| 370 |
"scale": "" |
| 371 |
}, |
| 372 |
"tablet": { |
| 373 |
"x": "", |
| 374 |
"y": "", |
| 375 |
"scale": "" |
| 376 |
}, |
| 377 |
"mobile": { |
| 378 |
"x": "", |
| 379 |
"y": "", |
| 380 |
"scale": "" |
| 381 |
} |
| 382 |
}, |
| 383 |
"skew": { |
| 384 |
"desktop": { |
| 385 |
"x": "", |
| 386 |
"y": "" |
| 387 |
}, |
| 388 |
"tablet": { |
| 389 |
"x": "", |
| 390 |
"y": "" |
| 391 |
}, |
| 392 |
"mobile": { |
| 393 |
"x": "", |
| 394 |
"y": "" |
| 395 |
} |
| 396 |
}, |
| 397 |
"flipX": false, |
| 398 |
"flipY": false |
| 399 |
}, |
| 400 |
"hover": { |
| 401 |
"rotate": { |
| 402 |
"desktop": { |
| 403 |
"z": "", |
| 404 |
"y": "", |
| 405 |
"x": "" |
| 406 |
}, |
| 407 |
"tablet": { |
| 408 |
"z": "", |
| 409 |
"y": "", |
| 410 |
"x": "" |
| 411 |
}, |
| 412 |
"mobile": { |
| 413 |
"z": "", |
| 414 |
"y": "", |
| 415 |
"x": "" |
| 416 |
}, |
| 417 |
"threeDRotate": false |
| 418 |
}, |
| 419 |
"offset": { |
| 420 |
"desktop": { |
| 421 |
"x": "", |
| 422 |
"y": "" |
| 423 |
}, |
| 424 |
"tablet": { |
| 425 |
"x": "", |
| 426 |
"y": "" |
| 427 |
}, |
| 428 |
"mobile": { |
| 429 |
"x": "", |
| 430 |
"y": "" |
| 431 |
} |
| 432 |
}, |
| 433 |
"scale": { |
| 434 |
"isProportion": true, |
| 435 |
"desktop": { |
| 436 |
"x": "", |
| 437 |
"y": "", |
| 438 |
"scale": "" |
| 439 |
}, |
| 440 |
"tablet": { |
| 441 |
"x": "", |
| 442 |
"y": "", |
| 443 |
"scale": "" |
| 444 |
}, |
| 445 |
"mobile": { |
| 446 |
"x": "", |
| 447 |
"y": "", |
| 448 |
"scale": "" |
| 449 |
} |
| 450 |
}, |
| 451 |
"skew": { |
| 452 |
"desktop": { |
| 453 |
"x": "", |
| 454 |
"y": "" |
| 455 |
}, |
| 456 |
"tablet": { |
| 457 |
"x": "", |
| 458 |
"y": "" |
| 459 |
}, |
| 460 |
"mobile": { |
| 461 |
"x": "", |
| 462 |
"y": "" |
| 463 |
} |
| 464 |
}, |
| 465 |
"flipX": false, |
| 466 |
"flipY": false |
| 467 |
}, |
| 468 |
"transition": 200 |
| 469 |
}, |
| 470 |
"borderShadow": { |
| 471 |
"normal": { |
| 472 |
"radius": { |
| 473 |
"top": "", |
| 474 |
"right": "", |
| 475 |
"bottom": "", |
| 476 |
"left": "" |
| 477 |
}, |
| 478 |
"shadow": [ |
| 479 |
{ |
| 480 |
"hOffset": "", |
| 481 |
"vOffset": "", |
| 482 |
"blur": "", |
| 483 |
"spreed": "", |
| 484 |
"color": "", |
| 485 |
"isInset": false |
| 486 |
} |
| 487 |
] |
| 488 |
} |
| 489 |
}, |
| 490 |
"background": { |
| 491 |
"normal": { |
| 492 |
"type": "color", |
| 493 |
"color": "", |
| 494 |
"gradient": { |
| 495 |
"type": "radial", |
| 496 |
"radialType": "ellipse", |
| 497 |
"colors": [ |
| 498 |
{ |
| 499 |
"color": "", |
| 500 |
"position": "0" |
| 501 |
}, |
| 502 |
{ |
| 503 |
"color": "", |
| 504 |
"position": "80" |
| 505 |
} |
| 506 |
], |
| 507 |
"centerPositions": { |
| 508 |
"x": 50, |
| 509 |
"y": 50 |
| 510 |
}, |
| 511 |
"angel": 90 |
| 512 |
}, |
| 513 |
"img": { |
| 514 |
"url": "", |
| 515 |
"desktop": { |
| 516 |
"position": "center center", |
| 517 |
"xPosition": 0, |
| 518 |
"yPosition": 0, |
| 519 |
"attachment": "", |
| 520 |
"repeat": "no-repeat", |
| 521 |
"size": "", |
| 522 |
"customSize": "0px" |
| 523 |
}, |
| 524 |
"tablet": { |
| 525 |
"position": "center center", |
| 526 |
"xPosition": 0, |
| 527 |
"yPosition": 0, |
| 528 |
"attachment": "", |
| 529 |
"repeat": "no-repeat", |
| 530 |
"size": "", |
| 531 |
"customSize": "0px" |
| 532 |
}, |
| 533 |
"mobile": { |
| 534 |
"position": "center center", |
| 535 |
"xPosition": 0, |
| 536 |
"yPosition": 0, |
| 537 |
"attachment": "", |
| 538 |
"repeat": "no-repeat", |
| 539 |
"size": "", |
| 540 |
"customSize": "0px" |
| 541 |
} |
| 542 |
}, |
| 543 |
"video": { |
| 544 |
"url": "", |
| 545 |
"loop": false |
| 546 |
}, |
| 547 |
"transition": 0.3 |
| 548 |
} |
| 549 |
} |
| 550 |
} |
| 551 |
} |
| 552 |
}, |
| 553 |
"editorScript": "file:../index.js", |
| 554 |
"style": "file:./view.css", |
| 555 |
"render": "file:./render.php", |
| 556 |
"viewScript": "file:./view.js" |
| 557 |
} |