PluginProbe
codoc / 0.9.61
codoc v0.9.61
0.9.61 0.9.8.8 0.9.8.9 0.9.9 0.9.9.1 trunk 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.8.1 0.8.2 0.8.3 0.8.4 0.8.6 0.8.7 0.8.8 0.8.9 0.9 0.9.1 0.9.10 All 115 releases
← All changes | src/block/block.js +310 -64 0.9.9.1 → 0.9.61 View file →
@@ -10,9 +10,8 @@
10 10 import './editor.scss';
11 11 import icon from './icon';
12 12 //import { ENTER } from '@wordpress/keycodes';
13 13 const { ENTER } = wp.keycodes;
14 -
15 14 const { __ } = wp.i18n; // Import __() from wp.i18n
16 15 const { Component } = wp.element;
17 16
18 17 const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
@@ -26,10 +25,14 @@
26 25 PanelBody,
27 26 ToggleControl,
28 27 CheckboxControl,
29 28 RangeControl,
29 + TextControl,
30 + Notice,
30 31 } = wp.components;
31 32
33 +const { withSelect } = wp.data;
34 +
32 35 const {
33 36 getDefaultBlockName,
34 37 createBlock,
35 38 } = wp.blocks;
@@ -39,20 +42,151 @@
39 42 const CODOC_URL = OPTIONS.codoc_url;
40 43 const CODOC_USER_CODE = OPTIONS.codoc_usercode;
41 44 const CODOC_PLUGIN_VERSION = OPTIONS.codoc_plugin_version;
42 45 const CODOC_ENTRIES_CLASS = 'codoc-entries';
46 +const CODOC_ACCOUNT_IS_PRO = OPTIONS.codoc_account_is_pro;
47 +const CODOC_CURRENCY_CODE = OPTIONS.codoc_currency_code;
48 +const CODOC_CURRENCY_DECIMAL_PLACES = OPTIONS.codoc_currency_decimal_places;
43 49
44 50 //import Cookies from 'universal-cookie';
45 51 //const cookies = new Cookies();
46 52
53 +const CODOC_MAX_LENGTHS = OPTIONS.codoc_max_lengths || {};
54 +
55 +// エディタで前回使った設定を localStorage に保存し、新規ブロックの初期値に使う
56 +// (優先順位: 設定画面の Block Default Values -> 前回値 -> 固定値)
57 +const CODOC_LAST_USED_KEY = 'codoc_block_last_used';
58 +const CODOC_LAST_USED_ATTRS = ['showPrice','price','limited','limitedCount','affiliateMode','affiliateRate','showSupport','showPaywalledSupport','showPayWithoutAccountButton','statusLimited','subscriptions'];
59 +function loadLastUsedAttributes() {
60 + try {
61 + const parsed = JSON.parse(window.localStorage.getItem(CODOC_LAST_USED_KEY) || 'null');
62 + return (parsed && typeof parsed === 'object') ? parsed : {};
63 + } catch (e) {
64 + return {};
65 + }
66 +}
67 +function saveLastUsedAttributes(attributes) {
68 + try {
69 + const saved = {};
70 + CODOC_LAST_USED_ATTRS.forEach((key) => {
71 + if (attributes[key] !== undefined && attributes[key] !== null) {
72 + saved[key] = attributes[key];
73 + }
74 + });
75 + window.localStorage.setItem(CODOC_LAST_USED_KEY, JSON.stringify(saved));
76 + } catch (e) {
77 + // localStorage が使えない環境では何もしない
78 + }
79 +}
80 +
81 +// codoc ブロックの直前/直後で本文を分割
82 +function splitCodocContent(content) {
83 + const blockRegex = /<!--\s*wp:codoc\/codoc-block[\s\S]*?<!--\s*\/wp:codoc\/codoc-block\s*-->/;
84 + const splited = (content || '').split(blockRegex);
85 + return {
86 + bodyFree: splited[0] || '',
87 + bodyPaywalled: splited.slice(1).join('') || '',
88 + };
89 +}
90 +
91 +function buildLengthErrors(title, bodyFree, bodyPaywalled) {
92 + const errors = [];
93 + const total = bodyFree.length + bodyPaywalled.length;
94 + if (CODOC_MAX_LENGTHS.title && title.length > CODOC_MAX_LENGTHS.title) {
95 + errors.push(__('Title exceeds the maximum length of', 'codoc') + ' ' + CODOC_MAX_LENGTHS.title + ' (' + title.length + ')');
96 + }
97 + if (CODOC_MAX_LENGTHS.body_free && bodyFree.length > CODOC_MAX_LENGTHS.body_free) {
98 + errors.push(__('Free area exceeds the maximum length of', 'codoc') + ' ' + CODOC_MAX_LENGTHS.body_free + ' (' + bodyFree.length + ')');
99 + }
100 + if (CODOC_MAX_LENGTHS.body_paywalled && bodyPaywalled.length > CODOC_MAX_LENGTHS.body_paywalled) {
101 + errors.push(__('Paid area exceeds the maximum length of', 'codoc') + ' ' + CODOC_MAX_LENGTHS.body_paywalled + ' (' + bodyPaywalled.length + ')');
102 + }
103 + if (CODOC_MAX_LENGTHS.body && total > CODOC_MAX_LENGTHS.body) {
104 + errors.push(__('Total body exceeds the maximum length of', 'codoc') + ' ' + CODOC_MAX_LENGTHS.body + ' (' + total + ')');
105 + }
106 + return errors;
107 +}
108 +
109 +// codoc ブロック選択時の Inspector サイドバーに警告を表示する
110 +const CodocLengthNotices = withSelect((select) => {
111 + const editor = select('core/editor');
112 + return {
113 + postTitle: editor ? editor.getEditedPostAttribute('title') : '',
114 + postContent: editor ? editor.getEditedPostAttribute('content') : '',
115 + };
116 +})(({ postTitle, postContent }) => {
117 + const { bodyFree, bodyPaywalled } = splitCodocContent(postContent);
118 + const errors = buildLengthErrors(postTitle || '', bodyFree, bodyPaywalled);
119 + if (errors.length === 0) {
120 + return null;
121 + }
122 + return (
123 + <Notice status="error" isDismissible={ false }>
124 + <strong>{ __('codoc length limit exceeded:', 'codoc') }</strong>
125 + <ul style={{ marginTop: '0.5em', marginBottom: 0 }}>
126 + { errors.map((e, i) => <li key={i}>{ e }</li>) }
127 + </ul>
128 + </Notice>
129 + );
130 +});
131 +
132 +// codoc ブロックを選択していなくても、本文中に存在すればエディタ上部に通知を表示する
133 +(function() {
134 + if (!wp.data || !wp.data.subscribe) {
135 + return;
136 + }
137 + const NOTICE_ID = 'codoc-length-limit';
138 + let lastState = '';
139 + wp.data.subscribe(function() {
140 + const editor = wp.data.select('core/editor');
141 + const blockEditor = wp.data.select('core/block-editor') || wp.data.select('core/editor');
142 + const noticesDispatch = wp.data.dispatch('core/notices');
143 + if (!editor || !blockEditor || !noticesDispatch) {
144 + return;
145 + }
146 + const blocks = blockEditor.getBlocks ? blockEditor.getBlocks() : [];
147 + const hasCodocBlock = blocks.some(function(b) { return b && b.name === 'codoc/codoc-block'; });
148 + if (!hasCodocBlock) {
149 + if (lastState !== '') {
150 + noticesDispatch.removeNotice(NOTICE_ID);
151 + lastState = '';
152 + }
153 + return;
154 + }
155 + const title = editor.getEditedPostAttribute('title') || '';
156 + const content = editor.getEditedPostAttribute('content') || '';
157 + const { bodyFree, bodyPaywalled } = splitCodocContent(content);
158 + const errors = buildLengthErrors(title, bodyFree, bodyPaywalled);
159 + const state = errors.join('||');
160 + if (state === lastState) {
161 + return;
162 + }
163 + lastState = state;
164 + noticesDispatch.removeNotice(NOTICE_ID);
165 + if (errors.length > 0) {
166 + noticesDispatch.createNotice(
167 + 'error',
168 + __('codoc length limit exceeded:', 'codoc') + ' ' + errors.join(' / '),
169 + { id: NOTICE_ID, isDismissible: false }
170 + );
171 + }
172 + });
173 +})();
174 +
47 175 class CodocControls extends Component {
48 176 constructor( props ) {
49 177 super( ...arguments );
50 178 this.subscriptionsFetched = [];
179 + this.subscriptionSearchTerm = '';
180 + this.state = {
181 + searchTerm: '',
182 + filteredSubscriptions: []
183 + };
51 184 this.fetchSubscriptions();
185 + this.handleSearchChange = this.handleSearchChange.bind(this);
52 186 }
53 187
54 - fetchSubscriptions() {
188 + fetchSubscriptions(searchTitle = '') {
55 189 const {
56 190 setAttributes,
57 191 attributes: {
58 192 fetching,
@@ -65,8 +199,13 @@
65 199
66 200 setAttributes( { fetching: true } )
67 201 let url = CODOC_URL + '/api/v1/cms/' + CODOC_USER_CODE + '/subscriptions?without_token=1';
68 202
203 + // Add title parameter if search term exists
204 + if (searchTitle) {
205 + url += '&title=' + encodeURIComponent(searchTitle);
206 + }
207 +
69 208 fetch(url)
70 209 .then( res => res.json() )
71 210 .then( res => {
72 211 let list = [];
@@ -74,38 +213,62 @@
74 213 for ( var i = 0; i < res.subscriptions.length; i++ ) {
75 214 let info = {
76 215 value: res.subscriptions[i].code,
77 216 label: res.subscriptions[i].title,
217 + term: res.subscriptions[i].term,
218 + price: res.subscriptions[i].price,
219 + currency: res.subscriptions[i].currency
78 220 }
79 221 list[i] = info
80 222 }
81 223 }
82 - if (list.length) {
224 + if (list.length || searchTitle) {
83 225 this.subscriptionsFetched = list;
226 + this.setState({ filteredSubscriptions: list });
84 227 }
85 228 setAttributes( { fetching: false } )
86 229 })
87 230 }
88 231
232 + handleSearchChange(value) {
233 + this.setState({ searchTerm: value });
234 +
235 + // Debounce the API call
236 + clearTimeout(this.searchTimeout);
237 + this.searchTimeout = setTimeout(() => {
238 + this.fetchSubscriptions(value);
239 + }, 500);
240 + }
241 +
89 242 getShowPriceHelp( checked ) {
90 243 return checked ?
91 - __( 'する' ) :
92 - __( 'しない' );
244 + __( 'Enable','codoc' ) :
245 + __( 'Disable','codoc' );
93 246 }
94 247 getShowSupportHelp( checked ) {
95 248 return checked ?
96 - __( '受け付ける' ) :
97 - __( '受け付けない' );
249 + __( 'Accept' ,'codoc') :
250 + __( 'Do not accept' ,'codoc');
98 251 }
99 252 getShowPaywalledSupportHelp( checked ) {
100 253 return checked ?
101 - __( '有料パートはアクセス時に非表示となりますが、「自由課金で読む」をタップ後に表示されます。閲覧者は内容に応じて金額を自由に指定して購入できます。購入されない場合もあるのでご注意ください。' ) :
102 - __( '' );
254 + __( 'The paid part will be hidden upon access, but will be displayed after tapping "Pay to Read". Viewers can freely specify the amount to purchase based on the content. Please note that there may be cases where it is not purchased.' ,'codoc') :
255 + __( ' ' );
103 256 }
257 + getStatusLimitedHelp( checked ) {
258 + return checked ?
259 + __( 'Unlisted' ,'codoc') :
260 + __( 'Published' ,'codoc');
261 + }
262 + getShowPayWithoutAccountButtonHelp( checked ) {
263 + return checked ?
264 + __( 'Viewers can purchase without a codoc account.' ,'codoc') :
265 + __( 'Viewers must log in to codoc to purchase.' ,'codoc');
266 + }
104 267
105 268 render() {
106 269 const {
107 - setAttributes,
270 + setAttributes: setBlockAttributes,
108 271 attributes: {
109 272 showPrice,
110 273 price,
111 274 limited,
@@ -115,60 +278,99 @@
115 278 affiliateRate,
116 279
117 280 showSupport,
118 281 showPaywalledSupport,
119 -
282 + showPayWithoutAccountButton,
283 + statusLimited,
120 284 subscriptions,
121 285 }
122 286 } = this.props;
287 + // 設定変更のたびに前回値として保存
288 + const setAttributes = (attrs) => {
289 + setBlockAttributes(attrs);
290 + saveLastUsedAttributes(Object.assign({}, this.props.attributes, attrs));
291 + };
123 292
124 293 const toggleShowPrice = () => setAttributes( { showPrice: ! showPrice } );
125 294 const toggleLimited = () => setAttributes( { limited: ! limited } );
126 295 const toggleShowPaywalledSupport = () => setAttributes( { showPaywalledSupport: ! showPaywalledSupport } );
296 + const toggleStatusLimited = () => setAttributes( { statusLimited: ! statusLimited } );
127 297 const toggleAffiliateMode = () => setAttributes( { affiliateMode: ! affiliateMode } );
128 298 const toggleShowSupport = () => setAttributes( { showSupport: ! showSupport } );
299 + const toggleShowPayWithoutAccountButton = () => setAttributes( { showPayWithoutAccountButton: ! showPayWithoutAccountButton } );
129 300
130 301 const SubscriptionCheckBoxes = withState({
131 - checked_obj: Object.assign(new Object, subscriptions)
132 - })( ( { checked_obj , setState } ) => (
302 + checked_obj: Object.assign({}, subscriptions)
303 + })( ({ checked_obj, setState }) => (
304 + <div>
305 + {this.state.filteredSubscriptions.length === 0 ? (
306 + <p style={{ fontStyle: 'italic', color: '#666' }}>
307 + { this.state.searchTerm
308 + ? __('No plans found matching your search.','codoc')
309 + : __('No reader plans available.','codoc')
310 + }
311 + </p>
312 + ) : (
133 313 <ul>
134 314 {
135 - this.subscriptionsFetched.map((v) => (
136 - <li><CheckboxControl
137 - className="check_items"
138 - label={v.label}
139 - checked={checked_obj[v.value]}
315 + this.state.filteredSubscriptions.map((v) => {
316 + const isChecked = !!checked_obj[v.value];
317 + const checkedCount = Object.keys(checked_obj).length;
140 318
141 - onChange={ ( check ) => {
142 - check ? checked_obj[v.value] = true : delete checked_obj[v.value]
143 - setAttributes({subscriptions : checked_obj})
144 - setState({checked_obj})
145 - } }
146 - /></li>
147 - ) )
319 + return (
320 + <li key={v.value}>
321 + <CheckboxControl
322 + className="check_items"
323 + label={v.label}
324 + checked={isChecked}
325 + onChange={(check) => {
326 + // 追加する場合、5個以上は無効
327 + if (check && checkedCount >= 5) {
328 + return; // これ以上チェックできない
329 + }
330 +
331 + const newChecked = { ...checked_obj };
332 +
333 + if (check) {
334 + newChecked[v.value] = true;
335 + } else {
336 + delete newChecked[v.value];
337 + }
338 +
339 + setAttributes({ subscriptions: newChecked });
340 + setState({ checked_obj: newChecked });
341 + }}
342 + />
343 + </li>
344 + );
345 + })
148 346 }
149 347 </ul>
348 + )}
349 + </div>
150 350 ) )
151 351 const affiliateRateOptions = [
152 - { value: '0.0500', label:'販売価格の5%' },
153 - { value: '0.1000', label:'販売価格の10%' },
154 - { value: '0.1500', label:'販売価格の15%' },
155 - { value: '0.2000', label:'販売価格の20%' },
156 - { value: '0.2500', label:'販売価格の25%' },
157 - { value: '0.3000', label:'販売価格の30%' },
158 - { value: '0.3500', label:'販売価格の35%' },
159 - { value: '0.4000', label:'販売価格の40%' },
160 - { value: '0.4500', label:'販売価格の45%' },
161 - { value: '0.5000', label:'販売価格の50%' },
352 + { value: '0.0500', label:'5%' },
353 + { value: '0.1000', label:'10%' },
354 + { value: '0.1500', label:'15%' },
355 + { value: '0.2000', label:'20%' },
356 + { value: '0.2500', label:'25%' },
357 + { value: '0.3000', label:'30%' },
358 + { value: '0.3500', label:'35%' },
359 + { value: '0.4000', label:'40%' },
360 + { value: '0.4500', label:'45%' },
361 + { value: '0.5000', label:'50%' },
162 362 ];
163 363
164 364 return(
165 365 <InspectorControls key="CodocControls">
166 366
367 + <CodocLengthNotices />
368 +
167 369 <PanelBody>
168 370
169 371 <ToggleControl
170 - label={ __( '単体販売' ) }
372 + label={ __( 'individual sale','codoc' ) }
171 373 checked={ !! showPrice }
172 374 help={ this.getShowPriceHelp }
173 375 ref="showPrice"
174 376 onChange={ toggleShowPrice }
@@ -174,11 +376,10 @@
174 376 onChange={ toggleShowPrice }
175 377 />
176 378
177 379 <div style={{ display: showPrice ? 'initial' : 'none' }}>
178 -
179 380 <RangeControl
180 - label={ __( '価格(円)') + __(showPaywalledSupport ? '【希望額として表示】' : '' ) }
381 + label={ __('price','codoc') + ' ' + (CODOC_CURRENCY_DECIMAL_PLACES > 0 ? (price / 100).toFixed(CODOC_CURRENCY_DECIMAL_PLACES) : price) + ' ' + __(CODOC_CURRENCY_CODE) + __(showPaywalledSupport ? '【' + __('Displayed as the your suggested price','codoc') + '】' : '' ) }
181 382 value={ price }
182 383 initialPosition={ price }
183 384 onChange={ ( value ) => {
184 385 // do validate this
@@ -184,13 +385,13 @@
184 385 // do validate this
185 386 setAttributes({ price: value });
186 387 }}
187 388 min="100"
188 - max="50000"
389 + max={ CODOC_ACCOUNT_IS_PRO == 1 ? 100000 : 50000 }
189 390 /><br />
190 391
191 392 <ToggleControl
192 - label={ __( '自由課金' ) }
393 + label={ __( 'Pay-what-you-want','codoc' ) }
193 394 checked={ !! showPaywalledSupport }
194 395 help={ this.getShowPaywalledSupportHelp }
195 396 onChange={ toggleShowPaywalledSupport }
196 397 />
@@ -196,9 +397,9 @@
196 397 />
197 398
198 399 <div style={{ display: showPaywalledSupport ? 'none' : 'initial' }}>
199 400 <ToggleControl
200 - label={ __( '数量限定販売' ) }
401 + label={ __( 'Limited quantity sale','codoc' ) }
201 402 checked={ !! limited }
202 403 onChange={ toggleLimited }
203 404 />
204 405
@@ -203,9 +404,9 @@
203 404 />
204 405
205 406 <div style={{ display: limited ? 'initial' : 'none' }}>
206 407 <RangeControl
207 - label={ __( '限定数' ) }
408 + label={ __( 'Limited quantity','codoc' ) }
208 409 value={ limitedCount }
209 410 onChange={ ( value ) => {
210 411 // do validate this
211 412 setAttributes({ limitedCount: value });
@@ -210,15 +411,15 @@
210 411 // do validate this
211 412 setAttributes({ limitedCount: value });
212 413 }}
213 414 initialPosition={ limitedCount }
214 - min="1"
415 + min="0"
215 416 max="100"
216 417 /><br />
217 418 </div>
218 419
219 420 <ToggleControl
220 - label={ __( 'アフィリエイト' ) }
421 + label={ __( 'Affiliate','codoc' ) }
221 422 checked={ !! affiliateMode }
222 423 onChange={ toggleAffiliateMode }
223 424 />
224 425
@@ -223,10 +424,10 @@
223 424 />
224 425
225 426 <div style={{ display: affiliateMode ? 'initial' : 'none' }}>
226 427 <SelectControl
227 - label={ __( '料率' ) }
228 - description={ __( '購入者を対象に指定した料率でアフィリエイトをオファーできます') }
428 + label={ __( 'Rate' , 'codoc') }
429 + description={ __( 'You can offer affiliate marketing at a specified rate for purchasers.', 'codoc') }
229 430 options={ affiliateRateOptions }
230 431 value={ affiliateRate }
231 432 onChange={ ( value ) => {
232 433 setAttributes( { affiliateRate: value } );
@@ -237,23 +438,55 @@
237 438 </div>
238 439
239 440 <div style={{ display: showPaywalledSupport ? 'none' : 'initial' }}>
240 441 <ToggleControl
241 - label={ __( 'サポート' ) }
442 + label={ __( 'Tipping', 'codoc') }
242 443 checked={ !! showSupport }
243 444 value="1"
244 445 onChange={ toggleShowSupport }
245 446 help={ this.getShowSupportHelp }
246 447 />
448 + </div>
449 +
450 + <div style={{ display: 'initial' }}>
451 + <ToggleControl
452 + label={ __( 'Guest purchase', 'codoc') }
453 + checked={ !! showPayWithoutAccountButton }
454 + value="1"
455 + onChange={ toggleShowPayWithoutAccountButton }
456 + help={ this.getShowPayWithoutAccountButtonHelp }
457 + />
458 + </div>
459 +
460 + <div style={{ display: 'initial' }}>
461 + <ToggleControl
462 + label={ __( 'Unlisted','codoc' ) }
463 + checked={ !! statusLimited }
464 + value="1"
465 + onChange={ toggleStatusLimited }
466 + help={ this.getStatusLimitedHelp }
467 + />
247 468 </div>
248 469
249 470 <div class="codoc-subscription-title">
250 - <label>サブスクリプション</label>
471 + <label>
472 + { __('Reader Plans','codoc') }
473 + </label>
251 474 <a
252 475 href={ CODOC_URL + '/me/subscriptions'}
253 - target="_blank" class="codoc-subscription-add">追加</a>
476 + target="_blank" class="codoc-subscription-add"
477 + >
478 + { __('Add','codoc') }
479 + </a>
254 480 </div>
255 481
482 + <TextControl
483 + label={ __('Search Plans','codoc') }
484 + value={ this.state.searchTerm }
485 + onChange={ this.handleSearchChange }
486 + placeholder={ __('Enter title to search...','codoc') }
487 + />
488 +
256 489 <SubscriptionCheckBoxes />
257 490
258 491
259 492 </PanelBody>
@@ -265,23 +498,28 @@
265 498 class EditBlockContent extends Component {
266 499 constructor() {
267 500 super( ...arguments );
268 501 // デフォルト値
502 + const bd = OPTIONS.codoc_block_defaults || {};
503 + const lu = loadLastUsedAttributes();
504 + const d = (key, fallback) => bd.hasOwnProperty(key) ? bd[key] : (lu.hasOwnProperty(key) ? lu[key] : fallback);
269 505 this.props.setAttributes({ version: CODOC_PLUGIN_VERSION });
270 - this.props.setAttributes({ showPrice: this.props.attributes.showPrice == null ? true : this.props.attributes.showPrice });
271 - this.props.setAttributes({ price: this.props.attributes.price == null ? 100 : this.props.attributes.price });
272 - this.props.setAttributes({ limited: this.props.attributes.limited == null ? false : this.props.attributes.limited });
273 - this.props.setAttributes({ limitedCount: this.props.attributes.limitedCount == null ? 10 : this.props.attributes.limitedCount });
274 - this.props.setAttributes({ affiliateMode: this.props.attributes.affiliateMode == null ? false : this.props.attributes.affiliateMode });
275 - this.props.setAttributes({ affiliateRate: this.props.attributes.affiliateRate == null ? '0.0500' : this.props.attributes.affiliateRate });
276 - this.props.setAttributes({ showSupport: this.props.attributes.showSupport == null ? false : this.props.attributes.showSupport });
277 - this.props.setAttributes({ showPaywalledSupport: this.props.attributes.showPaywalledSupport == null ? false : this.props.attributes.showPaywalledSupport });
278 - this.props.setAttributes({ subscriptions: this.props.attributes.subscriptions == null ? {} : this.props.attributes.subscriptions });
506 + this.props.setAttributes({ showPrice: this.props.attributes.showPrice == null ? d('showPrice', true) : this.props.attributes.showPrice });
507 + this.props.setAttributes({ price: this.props.attributes.price == null ? d('price', 500) : this.props.attributes.price });
508 + this.props.setAttributes({ limited: this.props.attributes.limited == null ? d('limited', false) : this.props.attributes.limited });
509 + this.props.setAttributes({ limitedCount: this.props.attributes.limitedCount == null ? d('limitedCount', 10) : this.props.attributes.limitedCount });
510 + this.props.setAttributes({ affiliateMode: this.props.attributes.affiliateMode == null ? d('affiliateMode', false) : this.props.attributes.affiliateMode });
511 + this.props.setAttributes({ affiliateRate: this.props.attributes.affiliateRate == null ? d('affiliateRate', '0.0500') : this.props.attributes.affiliateRate });
512 + this.props.setAttributes({ showSupport: this.props.attributes.showSupport == null ? d('showSupport', false) : this.props.attributes.showSupport });
513 + this.props.setAttributes({ showPaywalledSupport: this.props.attributes.showPaywalledSupport == null ? d('showPaywalledSupport', false) : this.props.attributes.showPaywalledSupport });
514 + this.props.setAttributes({ statusLimited: this.props.attributes.statusLimited == null ? d('statusLimited', false) : this.props.attributes.statusLimited });
515 + this.props.setAttributes({ showPayWithoutAccountButton: this.props.attributes.showPayWithoutAccountButton == null ? d('showPayWithoutAccountButton', true) : this.props.attributes.showPayWithoutAccountButton });
516 + this.props.setAttributes({ subscriptions: this.props.attributes.subscriptions == null ? d('subscriptions', {}) : this.props.attributes.subscriptions });
279 517
280 518 this.onChangeInput = this.onChangeInput.bind( this );
281 519 this.onKeyDown = this.onKeyDown.bind( this );
282 520 this.state = {
283 - defaultText: __( 'この続きをみるには' ),
521 + defaultText: __( 'To continue reading, ...','codoc' ),
284 522 };
285 523 }
286 524 onChangeInput( event ) {
287 525 this.setState( {
@@ -331,10 +569,10 @@
331 569 };
332 570
333 571
334 572 registerBlockType( 'codoc/codoc-block', {
335 - title: __( 'codoc' ),
336 - description: __( 'このブロックから下のブロックは認証されたcodocユーザーのみが閲覧できる有料エリアとなります。' ),
573 + title: __( 'codoc' ,'codoc'),
574 + description: __( 'The area from this block down is a paid area that only authenticated codoc users can view.','codoc' ),
337 575 icon,
338 576 category: 'layout',
339 577 supports: {
340 578 customClassName: false,
@@ -342,11 +580,11 @@
342 580 html: false,
343 581 multiple: false,
344 582 },
345 583 keywords: [
346 - __( 'codoc Block' ),
347 - __( 'plugin for codoc' ),
348 - __( 'codoc-block' ),
584 + __( 'codoc Block' ,'codoc'),
585 + __( 'plugin for codoc' ,'codoc'),
586 + __( 'codoc-block' ,'codoc'),
349 587 ],
350 588 attributes: {
351 589 showPrice: {
352 590 type: 'boolean',
@@ -376,8 +614,16 @@
376 614 type: 'boolean',
377 615 default: null,
378 616 },
379 617 showPaywalledSupport: {
618 + type: 'boolean',
619 + default: null,
620 + },
621 + statusLimited: {
622 + type: 'boolean',
623 + default: null,
624 + },
625 + showPayWithoutAccountButton: {
380 626 type: 'boolean',
381 627 default: null,
382 628 },
383 629 subscriptions: {