1.0.16
3 months ago
1.10.0
3 months ago
1.105.0
3 months ago
1.110.1
3 months ago
1.115.0
3 months ago
1.121.1
2 months ago
1.13.1
3 months ago
1.2.1
3 months ago
1.33.2
3 months ago
1.34.1
3 months ago
1.48.1
3 months ago
1.51.0
3 months ago
1.80.1
3 months ago
1.9.1
3 months ago
1.9.2
3 months ago
index.js
2 months ago
index.js
320 lines
| 1 | /* eslint camelcase: 0 */ |
| 2 | import save1_121_1 from './1.121.1/save'; |
| 3 | import save1_115_0 from './1.115.0/save'; |
| 4 | import save1_110_1 from './1.110.1/save'; |
| 5 | import save1_105_0 from './1.105.0/save'; |
| 6 | import save1_80_1 from './1.80.1/save'; |
| 7 | import save1_51_0 from './1.51.0/save'; |
| 8 | import save1_48_1 from './1.48.1/save'; |
| 9 | import save1_34_1 from './1.34.1/save'; |
| 10 | import save1_13_1 from './1.13.1/save'; |
| 11 | import save1_10_0 from './1.10.0/save'; |
| 12 | import save1_9_2 from './1.9.2/save'; |
| 13 | import save1_9_1 from './1.9.1/save'; |
| 14 | import save1_2_1 from './1.2.1/save'; |
| 15 | import save1_0_16 from './1.0.16/save'; |
| 16 | |
| 17 | const blockAttributes = { |
| 18 | unit: { |
| 19 | type: 'string', |
| 20 | default: 'px', |
| 21 | }, |
| 22 | pc: { |
| 23 | type: 'number', |
| 24 | default: 600, |
| 25 | }, |
| 26 | tablet: { |
| 27 | type: 'number', |
| 28 | default: 600, |
| 29 | }, |
| 30 | mobile: { |
| 31 | type: 'number', |
| 32 | default: 600, |
| 33 | }, |
| 34 | autoPlay: { |
| 35 | type: 'boolean', |
| 36 | default: true, |
| 37 | }, |
| 38 | autoPlayDelay: { |
| 39 | type: 'number', |
| 40 | default: 2500, |
| 41 | }, |
| 42 | pagination: { |
| 43 | type: 'boolean', |
| 44 | default: true, |
| 45 | }, |
| 46 | clientId: { |
| 47 | type: 'string', |
| 48 | default: '', |
| 49 | }, |
| 50 | width: { |
| 51 | type: 'string', |
| 52 | default: '', |
| 53 | }, |
| 54 | loop: { |
| 55 | type: 'boolean', |
| 56 | default: true, |
| 57 | }, |
| 58 | effect: { |
| 59 | type: 'string', |
| 60 | default: 'slide', |
| 61 | }, |
| 62 | speed: { |
| 63 | type: 'number', |
| 64 | default: 300, |
| 65 | }, |
| 66 | }; |
| 67 | |
| 68 | const blockAttributes2 = { |
| 69 | ...blockAttributes, |
| 70 | slidesPerView: { |
| 71 | type: 'number', |
| 72 | default: 1 |
| 73 | }, |
| 74 | slidesPerGroup: { |
| 75 | type: 'number', |
| 76 | default: 1 |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | const blockAttributes3 = { |
| 81 | ...blockAttributes2, |
| 82 | speed: { |
| 83 | type: 'number', |
| 84 | default: 500, |
| 85 | }, |
| 86 | } |
| 87 | |
| 88 | const blockAttributes4 = { |
| 89 | ...blockAttributes3, |
| 90 | autoPlayStop: { |
| 91 | type: 'boolean', |
| 92 | default: false |
| 93 | }, |
| 94 | pagination: { |
| 95 | type: 'string', |
| 96 | default: 'bullets' |
| 97 | }, |
| 98 | clientId: { |
| 99 | type: 'string', |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * 1.10.0 で高さのデフォルト値を変更 |
| 105 | */ |
| 106 | const blockAttributes5 = { |
| 107 | ...blockAttributes4, |
| 108 | pc: { |
| 109 | type: 'number' |
| 110 | }, |
| 111 | tablet: { |
| 112 | type: 'number' |
| 113 | }, |
| 114 | mobile: { |
| 115 | type: 'number' |
| 116 | }, |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * 1.11.0 でナビゲーション設定を追加 |
| 121 | */ |
| 122 | const blockAttributes6 = { |
| 123 | ...blockAttributes5, |
| 124 | navigationPosition: { |
| 125 | type: 'string', |
| 126 | default: 'mobile-bottom' |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * 1.34.1 で blockID を追加 |
| 132 | */ |
| 133 | const blockAttributes7 = { |
| 134 | ...blockAttributes6, |
| 135 | blockId: { |
| 136 | type: 'string' |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * 1.48.1 で追加された値 |
| 142 | */ |
| 143 | const blockAttributes8 = { |
| 144 | ...blockAttributes7, |
| 145 | slidesPerViewMobile: { |
| 146 | type: 'number', |
| 147 | default: 1 |
| 148 | }, |
| 149 | slidesPerViewTablet: { |
| 150 | type: 'number', |
| 151 | default: 1 |
| 152 | }, |
| 153 | slidesPerViewPC: { |
| 154 | type: 'number', |
| 155 | default: 1 |
| 156 | }, |
| 157 | slidesPerGroup: { |
| 158 | type: 'string', |
| 159 | default: 'one-by-one' |
| 160 | }, |
| 161 | } |
| 162 | |
| 163 | // 1.51.0 時点から追加された値 |
| 164 | const blockAttributes9 = { |
| 165 | ...blockAttributes8, |
| 166 | centeredSlides: { |
| 167 | type: 'boolean', |
| 168 | default: false |
| 169 | }, |
| 170 | editorMode: { |
| 171 | type: 'string', |
| 172 | default: 'default' |
| 173 | }, |
| 174 | } |
| 175 | |
| 176 | // 1.80.1 時点からの変更点 |
| 177 | const blockAttributes10 = { |
| 178 | ...blockAttributes9, |
| 179 | width: { |
| 180 | type: 'string' |
| 181 | }, |
| 182 | } |
| 183 | |
| 184 | const blockAttributes11 = { |
| 185 | ...blockAttributes10, |
| 186 | zoomAnimation: { |
| 187 | type: 'boolean', |
| 188 | default: false |
| 189 | }, |
| 190 | zoomInitialScale: { |
| 191 | type: 'number', |
| 192 | default: 1 |
| 193 | }, |
| 194 | zoomFinalScale: { |
| 195 | type: 'number', |
| 196 | default: 1.25 |
| 197 | }, |
| 198 | } |
| 199 | |
| 200 | // 1.110.1 時点からの変更点(direction属性を追加) |
| 201 | const blockAttributes12 = { |
| 202 | ...blockAttributes11, |
| 203 | direction: { |
| 204 | type: 'string', |
| 205 | default: 'rtl' |
| 206 | }, |
| 207 | } |
| 208 | |
| 209 | // zoomFinalScale が zoomFinalScal として保存されていた後方互換 |
| 210 | // blockAttributes11 から zoomFinalScale を除外し、typo版の zoomFinalScal のみにする |
| 211 | const { zoomFinalScale: _removed, ...blockAttributes11WithoutZoomFinalScale } = blockAttributes11; |
| 212 | const blockAttributes12Typo = { |
| 213 | ...blockAttributes11WithoutZoomFinalScale, |
| 214 | zoomFinalScal: { |
| 215 | type: 'number', |
| 216 | default: 1.25 |
| 217 | }, |
| 218 | direction: { |
| 219 | type: 'string', |
| 220 | default: 'rtl' |
| 221 | }, |
| 222 | } |
| 223 | |
| 224 | // 1.121.1 以降のスキーマ変更(pauseButton 属性の追加・autoPlayStop の既定値を false→true に変更)は |
| 225 | // 最新スキーマとして block.json が保持しているため、ここに blockAttributes13 は定義しない。 |
| 226 | // 直前バージョンまでの保存形式(pauseButton なし/autoPlayStop 既定 false)は |
| 227 | // blockAttributes12 を使う下記 deprecated エントリで救済する。 |
| 228 | |
| 229 | const migrateZoomFinalScaleTypo = (attributes) => { |
| 230 | // Backward compatibility: handle typo in old attribute name. |
| 231 | if ( |
| 232 | attributes.zoomFinalScale === undefined && |
| 233 | attributes.zoomFinalScal !== undefined |
| 234 | ) { |
| 235 | const { zoomFinalScal, ...rest } = attributes; |
| 236 | return { |
| 237 | ...rest, |
| 238 | zoomFinalScale: zoomFinalScal, |
| 239 | }; |
| 240 | } |
| 241 | return attributes; |
| 242 | }; |
| 243 | |
| 244 | const deprecated = [ |
| 245 | // pauseButton 属性追加・autoPlayStop の既定値を false→true に変更する前 |
| 246 | // (= 1.121.1 までの保存形式: pauseButton なし/autoPlayStop 既定 false)を救済する。 |
| 247 | { |
| 248 | attributes: blockAttributes12, |
| 249 | save: save1_121_1, |
| 250 | }, |
| 251 | { |
| 252 | attributes: blockAttributes12Typo, |
| 253 | save: save1_115_0, |
| 254 | migrate: migrateZoomFinalScaleTypo, |
| 255 | }, |
| 256 | { |
| 257 | attributes: blockAttributes12Typo, |
| 258 | save: save1_110_1, |
| 259 | migrate: migrateZoomFinalScaleTypo, |
| 260 | }, |
| 261 | { |
| 262 | attributes: blockAttributes12, |
| 263 | save: save1_115_0, |
| 264 | }, |
| 265 | { |
| 266 | attributes: blockAttributes12, |
| 267 | save: save1_110_1, |
| 268 | }, |
| 269 | { |
| 270 | attributes: blockAttributes11, |
| 271 | save: save1_110_1, |
| 272 | }, |
| 273 | { |
| 274 | attributes: blockAttributes10, |
| 275 | save: save1_105_0, |
| 276 | }, |
| 277 | { |
| 278 | attributes: blockAttributes9, |
| 279 | save: save1_80_1, |
| 280 | }, |
| 281 | { |
| 282 | attributes: blockAttributes8, |
| 283 | save: save1_51_0, |
| 284 | }, |
| 285 | { |
| 286 | attributes: blockAttributes7, |
| 287 | save: save1_48_1, |
| 288 | }, |
| 289 | { |
| 290 | attributes: blockAttributes6, |
| 291 | save: save1_34_1, |
| 292 | }, |
| 293 | { |
| 294 | attributes: blockAttributes6, |
| 295 | save: save1_13_1, |
| 296 | }, |
| 297 | { |
| 298 | attributes: blockAttributes5, |
| 299 | save: save1_10_0, |
| 300 | }, |
| 301 | { |
| 302 | attributes: blockAttributes4, |
| 303 | save: save1_9_2, |
| 304 | }, |
| 305 | { |
| 306 | attributes: blockAttributes3, |
| 307 | save: save1_9_1, |
| 308 | }, |
| 309 | { |
| 310 | attributes: blockAttributes2, |
| 311 | save: save1_2_1, |
| 312 | }, |
| 313 | { |
| 314 | attributes: blockAttributes, |
| 315 | save: save1_0_16, |
| 316 | }, |
| 317 | ]; |
| 318 | |
| 319 | export default deprecated; |
| 320 |