0.41.0
5 years ago
component-deprecated-id.js
5 years ago
component-deprecated-noopenernoreferer-id.js
5 years ago
component-deprecated-span-to-div.js
5 years ago
component-deprecated-subcaption-noNoopnnernoreferer-id.js
5 years ago
component-deprecated.js
5 years ago
componentV1.js
5 years ago
deprecated.js
5 years ago
deprecated.js
596 lines
| 1 | import { VKBButtonDeprecated } from "./component-deprecated"; |
| 2 | import { VKBButtonDeprecatedId } from "./component-deprecated-id"; |
| 3 | import { VKBButtonDeprecatedNoOpnnerNoRefererID } from "./component-deprecated-noopenernoreferer-id"; |
| 4 | import { VKBButtonDeprecatedSubcaptionNoopennerId } from "./component-deprecated-subcaption-noNoopnnernoreferer-id"; |
| 5 | import { VKBButton } from "../component"; |
| 6 | import { VKBButtonV1 } from "./componentV1" |
| 7 | import Schema0410 from "./0.41.0/schema" |
| 8 | import VKBButton0410 from "./0.41.0/block" |
| 9 | |
| 10 | import { vkbBlockEditor } from "./../../_helper/depModules"; |
| 11 | const { RichText } = vkbBlockEditor; |
| 12 | |
| 13 | export const deprecated = [ |
| 14 | { |
| 15 | attributes:Schema0410, |
| 16 | save:VKBButton0410 |
| 17 | }, |
| 18 | { |
| 19 | attributes: { |
| 20 | content: { |
| 21 | type: 'string', |
| 22 | source: 'html', |
| 23 | selector: 'span', |
| 24 | }, |
| 25 | subCaption: { |
| 26 | type: 'string', |
| 27 | default: "", |
| 28 | }, |
| 29 | buttonUrl: { |
| 30 | type: 'string', |
| 31 | default: "", |
| 32 | }, |
| 33 | buttonTarget: { |
| 34 | type: 'Boolean', |
| 35 | default: false, |
| 36 | }, |
| 37 | buttonSize: { |
| 38 | type: 'string', |
| 39 | default: 'md', |
| 40 | }, |
| 41 | buttonType: { |
| 42 | type: 'string', |
| 43 | default: '0', |
| 44 | }, |
| 45 | buttonColor: { |
| 46 | type: 'string', |
| 47 | default: 'primary', |
| 48 | }, |
| 49 | buttonColorCustom: { |
| 50 | type: 'string', |
| 51 | default: 'undefined', |
| 52 | }, |
| 53 | buttonAlign: { |
| 54 | type: 'string', |
| 55 | default: 'left', |
| 56 | }, |
| 57 | fontAwesomeIconBefore: { |
| 58 | type: 'string', |
| 59 | default: "", |
| 60 | }, |
| 61 | fontAwesomeIconAfter: { |
| 62 | type: 'string', |
| 63 | default: "", |
| 64 | } |
| 65 | }, |
| 66 | save({ attributes, className }) { |
| 67 | const { |
| 68 | content, |
| 69 | subCaption, |
| 70 | buttonUrl, |
| 71 | buttonTarget, |
| 72 | buttonSize, |
| 73 | buttonType, |
| 74 | buttonColor, |
| 75 | buttonColorCustom, |
| 76 | buttonAlign, |
| 77 | fontAwesomeIconBefore, |
| 78 | fontAwesomeIconAfter, |
| 79 | } = attributes; |
| 80 | |
| 81 | let containerClass = ''; |
| 82 | if (buttonColorCustom) { |
| 83 | |
| 84 | containerClass = `vk_button vk_button-color-custom vk_button-align-${buttonAlign}`; |
| 85 | |
| 86 | } else if (!buttonColorCustom) { |
| 87 | |
| 88 | containerClass = `vk_button vk_button-align-${buttonAlign}`; |
| 89 | |
| 90 | } |
| 91 | |
| 92 | if (className) { |
| 93 | containerClass = className + ' ' + containerClass; |
| 94 | } |
| 95 | |
| 96 | return ( |
| 97 | <div className={ containerClass }> |
| 98 | |
| 99 | <VKBButtonV1 lbColorCustom={ buttonColorCustom } lbColor={ buttonColor } lbType={ buttonType } |
| 100 | lbAlign={ buttonAlign } |
| 101 | lbSize={ buttonSize } |
| 102 | lbUrl={ buttonUrl } |
| 103 | lbTarget={ buttonTarget } |
| 104 | lbFontAwesomeIconBefore={ fontAwesomeIconBefore } |
| 105 | lbFontAwesomeIconAfter={ fontAwesomeIconAfter } |
| 106 | lbsubCaption={ subCaption } |
| 107 | lbRichtext={ |
| 108 | <RichText.Content |
| 109 | tagName="span" |
| 110 | className={ 'vk_button_link_txt' } |
| 111 | value={ content } |
| 112 | /> |
| 113 | } /> |
| 114 | </div> |
| 115 | ); |
| 116 | } |
| 117 | }, |
| 118 | { |
| 119 | attributes: { |
| 120 | content: { |
| 121 | source: 'html', |
| 122 | selector: 'span', |
| 123 | }, |
| 124 | buttonUrl: { |
| 125 | type: 'string', |
| 126 | default: null, |
| 127 | }, |
| 128 | buttonTarget: { |
| 129 | type: 'Boolean', |
| 130 | default: false, |
| 131 | }, |
| 132 | buttonSize: { |
| 133 | type: 'string', |
| 134 | default: 'md', |
| 135 | }, |
| 136 | buttonType: { |
| 137 | type: 'string', |
| 138 | default: '0', |
| 139 | }, |
| 140 | buttonColor: { |
| 141 | type: 'string', |
| 142 | default: 'primary', |
| 143 | }, |
| 144 | buttonColorCustom: { |
| 145 | type: 'string', |
| 146 | default: null, |
| 147 | }, |
| 148 | buttonAlign: { |
| 149 | type: 'string', |
| 150 | default: 'left', |
| 151 | }, |
| 152 | fontAwesomeIconBefore: { |
| 153 | type: 'string', |
| 154 | default: null, |
| 155 | }, |
| 156 | fontAwesomeIconAfter: { |
| 157 | type: 'string', |
| 158 | default: null, |
| 159 | } |
| 160 | }, |
| 161 | |
| 162 | save({ attributes }) { |
| 163 | const { |
| 164 | content, |
| 165 | buttonUrl, |
| 166 | buttonTarget, |
| 167 | buttonSize, |
| 168 | buttonType, |
| 169 | buttonColor, |
| 170 | buttonColorCustom, |
| 171 | buttonAlign, |
| 172 | fontAwesomeIconBefore, |
| 173 | fontAwesomeIconAfter, |
| 174 | } = attributes; |
| 175 | |
| 176 | let containerClass = ''; |
| 177 | |
| 178 | if (buttonColorCustom) { |
| 179 | |
| 180 | containerClass = `vk_button vk_button-color-custom vk_button-align-${buttonAlign}`; |
| 181 | |
| 182 | } else if (!buttonColorCustom) { |
| 183 | |
| 184 | containerClass = `vk_button vk_button-align-${buttonAlign}`; |
| 185 | |
| 186 | } |
| 187 | |
| 188 | return ( |
| 189 | <div className={ containerClass }> |
| 190 | |
| 191 | <VKBButtonDeprecated lbColorCustom={ buttonColorCustom } lbColor={ buttonColor } lbType={ buttonType } |
| 192 | lbAlign={ buttonAlign } |
| 193 | lbSize={ buttonSize } |
| 194 | lbUrl={ buttonUrl } |
| 195 | lbTarget={ buttonTarget } |
| 196 | lbFontAwesomeIconBefore={ fontAwesomeIconBefore } |
| 197 | lbFontAwesomeIconAfter={ fontAwesomeIconAfter } |
| 198 | lbRichtext={ |
| 199 | <RichText.Content |
| 200 | tagName="span" |
| 201 | className={ 'vk_button_link_txt' } |
| 202 | value={ content } |
| 203 | /> |
| 204 | } /> |
| 205 | </div> |
| 206 | ); |
| 207 | }, |
| 208 | }, |
| 209 | { |
| 210 | attributes: { |
| 211 | content: { |
| 212 | source: 'html', |
| 213 | selector: 'span', |
| 214 | }, |
| 215 | buttonUrl: { |
| 216 | type: 'string', |
| 217 | default: null, |
| 218 | }, |
| 219 | buttonTarget: { |
| 220 | type: 'Boolean', |
| 221 | default: false, |
| 222 | }, |
| 223 | buttonSize: { |
| 224 | type: 'string', |
| 225 | default: 'md', |
| 226 | }, |
| 227 | buttonType: { |
| 228 | type: 'string', |
| 229 | default: '0', |
| 230 | }, |
| 231 | buttonColor: { |
| 232 | type: 'string', |
| 233 | default: 'primary', |
| 234 | }, |
| 235 | buttonColorCustom: { |
| 236 | type: 'string', |
| 237 | default: null, |
| 238 | }, |
| 239 | buttonAlign: { |
| 240 | type: 'string', |
| 241 | default: 'left', |
| 242 | }, |
| 243 | fontAwesomeIconBefore: { |
| 244 | type: 'string', |
| 245 | default: null, |
| 246 | }, |
| 247 | fontAwesomeIconAfter: { |
| 248 | type: 'string', |
| 249 | default: null, |
| 250 | } |
| 251 | }, |
| 252 | |
| 253 | save({ attributes }) { |
| 254 | const { |
| 255 | content, |
| 256 | buttonUrl, |
| 257 | buttonTarget, |
| 258 | buttonSize, |
| 259 | buttonType, |
| 260 | buttonColor, |
| 261 | buttonColorCustom, |
| 262 | buttonAlign, |
| 263 | fontAwesomeIconBefore, |
| 264 | fontAwesomeIconAfter, |
| 265 | } = attributes; |
| 266 | |
| 267 | let containerClass = ''; |
| 268 | |
| 269 | if (buttonColorCustom) { |
| 270 | |
| 271 | containerClass = `vk_button vk_button-color-custom vk_button-align-${buttonAlign}`; |
| 272 | |
| 273 | } else if (!buttonColorCustom) { |
| 274 | |
| 275 | containerClass = `vk_button vk_button-align-${buttonAlign}`; |
| 276 | |
| 277 | } |
| 278 | |
| 279 | return ( |
| 280 | <div className={ containerClass }> |
| 281 | |
| 282 | <VKBButtonDeprecatedId lbColorCustom={ buttonColorCustom } lbColor={ buttonColor } lbType={ buttonType } |
| 283 | lbAlign={ buttonAlign } |
| 284 | lbSize={ buttonSize } |
| 285 | lbUrl={ buttonUrl } |
| 286 | lbTarget={ buttonTarget } |
| 287 | lbFontAwesomeIconBefore={ fontAwesomeIconBefore } |
| 288 | lbFontAwesomeIconAfter={ fontAwesomeIconAfter } |
| 289 | lbRichtext={ |
| 290 | <RichText.Content |
| 291 | tagName="span" |
| 292 | className={ 'vk_button_link_txt' } |
| 293 | value={ content } |
| 294 | /> |
| 295 | } /> |
| 296 | </div> |
| 297 | ); |
| 298 | }, |
| 299 | }, |
| 300 | { |
| 301 | attributes: { |
| 302 | content: { |
| 303 | source: 'html', |
| 304 | selector: 'span', |
| 305 | }, |
| 306 | subCaption: { |
| 307 | type: 'string', |
| 308 | default: null, |
| 309 | }, |
| 310 | buttonUrl: { |
| 311 | type: 'string', |
| 312 | default: null, |
| 313 | }, |
| 314 | buttonTarget: { |
| 315 | type: 'Boolean', |
| 316 | default: false, |
| 317 | }, |
| 318 | buttonSize: { |
| 319 | type: 'string', |
| 320 | default: 'md', |
| 321 | }, |
| 322 | buttonType: { |
| 323 | type: 'string', |
| 324 | default: '0', |
| 325 | }, |
| 326 | buttonColor: { |
| 327 | type: 'string', |
| 328 | default: 'primary', |
| 329 | }, |
| 330 | buttonColorCustom: { |
| 331 | type: 'string', |
| 332 | default: null, |
| 333 | }, |
| 334 | buttonAlign: { |
| 335 | type: 'string', |
| 336 | default: 'left', |
| 337 | }, |
| 338 | fontAwesomeIconBefore: { |
| 339 | type: 'string', |
| 340 | default: null, |
| 341 | }, |
| 342 | fontAwesomeIconAfter: { |
| 343 | type: 'string', |
| 344 | default: null, |
| 345 | } |
| 346 | }, |
| 347 | save({ attributes, className }) { |
| 348 | const { |
| 349 | content, |
| 350 | subCaption, |
| 351 | buttonUrl, |
| 352 | buttonTarget, |
| 353 | buttonSize, |
| 354 | buttonType, |
| 355 | buttonColor, |
| 356 | buttonColorCustom, |
| 357 | buttonAlign, |
| 358 | fontAwesomeIconBefore, |
| 359 | fontAwesomeIconAfter, |
| 360 | } = attributes; |
| 361 | |
| 362 | let containerClass = ''; |
| 363 | |
| 364 | if (buttonColorCustom) { |
| 365 | |
| 366 | containerClass = `vk_button vk_button-color-custom vk_button-align-${buttonAlign}`; |
| 367 | |
| 368 | } else if (!buttonColorCustom) { |
| 369 | |
| 370 | containerClass = `vk_button vk_button-align-${buttonAlign}`; |
| 371 | |
| 372 | } |
| 373 | |
| 374 | return ( |
| 375 | <div className={ containerClass }> |
| 376 | |
| 377 | <VKBButtonDeprecatedNoOpnnerNoRefererID lbColorCustom={ buttonColorCustom } lbColor={ buttonColor } |
| 378 | lbType={ buttonType } |
| 379 | lbAlign={ buttonAlign } |
| 380 | lbSize={ buttonSize } |
| 381 | lbUrl={ buttonUrl } |
| 382 | lbTarget={ buttonTarget } |
| 383 | lbFontAwesomeIconBefore={ fontAwesomeIconBefore } |
| 384 | lbFontAwesomeIconAfter={ fontAwesomeIconAfter } |
| 385 | lbsubCaption={ subCaption } |
| 386 | lbRichtext={ |
| 387 | <RichText.Content |
| 388 | tagName="span" |
| 389 | className={ 'vk_button_link_txt' } |
| 390 | value={ content } |
| 391 | /> |
| 392 | } /> |
| 393 | </div> |
| 394 | ); |
| 395 | }, |
| 396 | }, |
| 397 | { |
| 398 | attributes: { |
| 399 | content: { |
| 400 | source: 'html', |
| 401 | selector: 'span', |
| 402 | }, |
| 403 | subCaption: { |
| 404 | type: 'string', |
| 405 | default: null, |
| 406 | }, |
| 407 | buttonUrl: { |
| 408 | type: 'string', |
| 409 | default: null, |
| 410 | }, |
| 411 | buttonTarget: { |
| 412 | type: 'Boolean', |
| 413 | default: false, |
| 414 | }, |
| 415 | buttonSize: { |
| 416 | type: 'string', |
| 417 | default: 'md', |
| 418 | }, |
| 419 | buttonType: { |
| 420 | type: 'string', |
| 421 | default: '0', |
| 422 | }, |
| 423 | buttonColor: { |
| 424 | type: 'string', |
| 425 | default: 'primary', |
| 426 | }, |
| 427 | buttonColorCustom: { |
| 428 | type: 'string', |
| 429 | default: null, |
| 430 | }, |
| 431 | buttonAlign: { |
| 432 | type: 'string', |
| 433 | default: 'left', |
| 434 | }, |
| 435 | fontAwesomeIconBefore: { |
| 436 | type: 'string', |
| 437 | default: null, |
| 438 | }, |
| 439 | fontAwesomeIconAfter: { |
| 440 | type: 'string', |
| 441 | default: null, |
| 442 | } |
| 443 | }, |
| 444 | save({ attributes, className }) { |
| 445 | const { |
| 446 | content, |
| 447 | subCaption, |
| 448 | buttonUrl, |
| 449 | buttonTarget, |
| 450 | buttonSize, |
| 451 | buttonType, |
| 452 | buttonColor, |
| 453 | buttonColorCustom, |
| 454 | buttonAlign, |
| 455 | fontAwesomeIconBefore, |
| 456 | fontAwesomeIconAfter, |
| 457 | } = attributes; |
| 458 | |
| 459 | let containerClass = ''; |
| 460 | |
| 461 | if (buttonColorCustom) { |
| 462 | |
| 463 | containerClass = `vk_button vk_button-color-custom vk_button-align-${buttonAlign}`; |
| 464 | |
| 465 | } else if (!buttonColorCustom) { |
| 466 | |
| 467 | containerClass = `vk_button vk_button-align-${buttonAlign}`; |
| 468 | |
| 469 | } |
| 470 | |
| 471 | return ( |
| 472 | <div className={ containerClass }> |
| 473 | |
| 474 | <VKBButtonDeprecatedSubcaptionNoopennerId lbColorCustom={ buttonColorCustom } |
| 475 | lbColor={ buttonColor } |
| 476 | lbType={ buttonType } |
| 477 | lbAlign={ buttonAlign } |
| 478 | lbSize={ buttonSize } |
| 479 | lbUrl={ buttonUrl } |
| 480 | lbTarget={ buttonTarget } |
| 481 | lbFontAwesomeIconBefore={ fontAwesomeIconBefore } |
| 482 | lbFontAwesomeIconAfter={ fontAwesomeIconAfter } |
| 483 | lbsubCaption={ subCaption } |
| 484 | lbRichtext={ |
| 485 | <RichText.Content |
| 486 | tagName="span" |
| 487 | className={ 'vk_button_link_txt' } |
| 488 | value={ content } |
| 489 | /> |
| 490 | } /> |
| 491 | </div> |
| 492 | ); |
| 493 | } |
| 494 | |
| 495 | }, |
| 496 | { |
| 497 | attributes: { |
| 498 | content: { |
| 499 | source: 'html', |
| 500 | selector: 'span', |
| 501 | }, |
| 502 | subCaption: { |
| 503 | type: 'string', |
| 504 | default: null, |
| 505 | }, |
| 506 | buttonUrl: { |
| 507 | type: 'string', |
| 508 | default: null, |
| 509 | }, |
| 510 | buttonTarget: { |
| 511 | type: 'Boolean', |
| 512 | default: false, |
| 513 | }, |
| 514 | buttonSize: { |
| 515 | type: 'string', |
| 516 | default: 'md', |
| 517 | }, |
| 518 | buttonType: { |
| 519 | type: 'string', |
| 520 | default: '0', |
| 521 | }, |
| 522 | buttonColor: { |
| 523 | type: 'string', |
| 524 | default: 'primary', |
| 525 | }, |
| 526 | buttonColorCustom: { |
| 527 | type: 'string', |
| 528 | default: null, |
| 529 | }, |
| 530 | buttonAlign: { |
| 531 | type: 'string', |
| 532 | default: 'left', |
| 533 | }, |
| 534 | fontAwesomeIconBefore: { |
| 535 | type: 'string', |
| 536 | default: null, |
| 537 | }, |
| 538 | fontAwesomeIconAfter: { |
| 539 | type: 'string', |
| 540 | default: null, |
| 541 | } |
| 542 | }, |
| 543 | save({ attributes, className }) { |
| 544 | const { |
| 545 | content, |
| 546 | subCaption, |
| 547 | buttonUrl, |
| 548 | buttonTarget, |
| 549 | buttonSize, |
| 550 | buttonType, |
| 551 | buttonColor, |
| 552 | buttonColorCustom, |
| 553 | buttonAlign, |
| 554 | fontAwesomeIconBefore, |
| 555 | fontAwesomeIconAfter, |
| 556 | } = attributes; |
| 557 | |
| 558 | let containerClass = ''; |
| 559 | if (buttonColorCustom) { |
| 560 | |
| 561 | containerClass = `vk_button vk_button-color-custom vk_button-align-${buttonAlign}`; |
| 562 | |
| 563 | } else if (!buttonColorCustom) { |
| 564 | |
| 565 | containerClass = `vk_button vk_button-align-${buttonAlign}`; |
| 566 | |
| 567 | } |
| 568 | |
| 569 | if (className) { |
| 570 | containerClass = className + ' ' + containerClass; |
| 571 | } |
| 572 | |
| 573 | return ( |
| 574 | <div className={ containerClass }> |
| 575 | |
| 576 | <VKBButton lbColorCustom={ buttonColorCustom } lbColor={ buttonColor } lbType={ buttonType } |
| 577 | lbAlign={ buttonAlign } |
| 578 | lbSize={ buttonSize } |
| 579 | lbUrl={ buttonUrl } |
| 580 | lbTarget={ buttonTarget } |
| 581 | lbFontAwesomeIconBefore={ fontAwesomeIconBefore } |
| 582 | lbFontAwesomeIconAfter={ fontAwesomeIconAfter } |
| 583 | lbsubCaption={ subCaption } |
| 584 | lbRichtext={ |
| 585 | <RichText.Content |
| 586 | tagName="span" |
| 587 | className={ 'vk_button_link_txt' } |
| 588 | value={ content } |
| 589 | /> |
| 590 | } /> |
| 591 | </div> |
| 592 | ); |
| 593 | } |
| 594 | } |
| 595 | ]; |
| 596 |