@zohodesk/dot 1.0.0-temp-197.2 → 1.0.0-temp-197.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -224,18 +224,6 @@ export default class TextEditor extends Component {
224
224
  global.editor[id] = editorObj;
225
225
  }
226
226
 
227
- const css = `pre {white-space: pre-wrap}, ${customCSS}`,
228
- head = editorObj.doc.head || editorObj.doc.getElementsByTagName('head')[0],
229
- style = document.createElement('style');
230
- style.type = 'text/css';
231
-
232
- if (style.styleSheet) {
233
- style.styleSheet.cssText = css;
234
- } else {
235
- style.appendChild(editorObj.doc.createTextNode(css));
236
- }
237
-
238
- head.appendChild(style);
239
227
  editorCallback && editorCallback(editorObj);
240
228
  const iframe = selectn('iframe.contentDocument.body', editorObj) || null;
241
229
  const iframeHead = selectn('iframe.contentDocument.head', editorObj) || null;
@@ -251,9 +239,11 @@ export default class TextEditor extends Component {
251
239
  iframe.classList.add('scroll');
252
240
  }
253
241
 
254
- let customFonts = document.createElement('style');
255
- customFonts.innerText = `@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}`;
256
- iframeHead.appendChild(customFonts);
242
+ let customStyleTag = document.createElement('style');
243
+ const customizedCSS = `pre {white-space: pre-wrap} ${customCSS}`;
244
+ const fontCSS = `@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}`;
245
+ customStyleTag.innerText = `${customizedCSS} ${fontCSS}`;
246
+ iframeHead.appendChild(customStyleTag);
257
247
  }
258
248
  }
259
249
 
@@ -10,6 +10,7 @@ export const defaultProps = {
10
10
  isNightMode: false,
11
11
  isReadOnly: false,
12
12
  dataSelectorId: 'textEditor',
13
+ customCSS: '',
13
14
  inlineImageProps: {
14
15
  allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
15
16
  fileNameMaxCharacters: 200,
@@ -203,7 +203,8 @@ export default class TextEditor extends Component {
203
203
  let {
204
204
  editorCallback,
205
205
  getRef,
206
- isCustomScroll
206
+ isCustomScroll,
207
+ customCSS
207
208
  } = this.props;
208
209
  this.setState({
209
210
  isEditorLoad: true,
@@ -218,18 +219,6 @@ export default class TextEditor extends Component {
218
219
  global.editor[id] = editorObj;
219
220
  }
220
221
 
221
- const css = 'pre {white-space: pre-wrap}',
222
- head = editorObj.doc.head || editorObj.doc.getElementsByTagName('head')[0],
223
- style = document.createElement('style');
224
- style.type = 'text/css';
225
-
226
- if (style.styleSheet) {
227
- style.styleSheet.cssText = css;
228
- } else {
229
- style.appendChild(editorObj.doc.createTextNode(css));
230
- }
231
-
232
- head.appendChild(style);
233
222
  editorCallback && editorCallback(editorObj);
234
223
  const iframe = selectn('iframe.contentDocument.body', editorObj) || null;
235
224
  const iframeHead = selectn('iframe.contentDocument.head', editorObj) || null;
@@ -245,9 +234,11 @@ export default class TextEditor extends Component {
245
234
  iframe.classList.add('scroll');
246
235
  }
247
236
 
248
- let customFonts = document.createElement('style');
249
- customFonts.innerText = `@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}`;
250
- iframeHead.appendChild(customFonts);
237
+ let customStyleTag = document.createElement('style');
238
+ const customizedCSS = `pre {white-space: pre-wrap} ${customCSS}`;
239
+ const fontCSS = `@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}`;
240
+ customStyleTag.innerText = `${customizedCSS} ${fontCSS}`;
241
+ iframeHead.appendChild(customStyleTag);
251
242
  }
252
243
  }
253
244
 
@@ -10,6 +10,7 @@ export const defaultProps = {
10
10
  isNightMode: false,
11
11
  isReadOnly: false,
12
12
  dataSelectorId: 'textEditor',
13
+ customCSS: '',
13
14
  inlineImageProps: {
14
15
  allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
15
16
  fileNameMaxCharacters: 200,
@@ -269,18 +269,6 @@ var TextEditor = /*#__PURE__*/function (_Component) {
269
269
  global.editor[id] = editorObj;
270
270
  }
271
271
 
272
- var css = "pre {white-space: pre-wrap}, ".concat(customCSS),
273
- head = editorObj.doc.head || editorObj.doc.getElementsByTagName('head')[0],
274
- style = document.createElement('style');
275
- style.type = 'text/css';
276
-
277
- if (style.styleSheet) {
278
- style.styleSheet.cssText = css;
279
- } else {
280
- style.appendChild(editorObj.doc.createTextNode(css));
281
- }
282
-
283
- head.appendChild(style);
284
272
  editorCallback && editorCallback(editorObj);
285
273
  var iframe = (0, _selectn["default"])('iframe.contentDocument.body', editorObj) || null;
286
274
  var iframeHead = (0, _selectn["default"])('iframe.contentDocument.head', editorObj) || null;
@@ -298,9 +286,11 @@ var TextEditor = /*#__PURE__*/function (_Component) {
298
286
  iframe.classList.add('scroll');
299
287
  }
300
288
 
301
- var customFonts = document.createElement('style');
302
- customFonts.innerText = "@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}";
303
- iframeHead.appendChild(customFonts);
289
+ var customStyleTag = document.createElement('style');
290
+ var customizedCSS = "pre {white-space: pre-wrap} ".concat(customCSS);
291
+ var fontCSS = "@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}";
292
+ customStyleTag.innerText = "".concat(customizedCSS, " ").concat(fontCSS);
293
+ iframeHead.appendChild(customStyleTag);
304
294
  }
305
295
  }
306
296
  }, {
@@ -16,6 +16,7 @@ var defaultProps = {
16
16
  isNightMode: false,
17
17
  isReadOnly: false,
18
18
  dataSelectorId: 'textEditor',
19
+ customCSS: '',
19
20
  inlineImageProps: {
20
21
  allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
21
22
  fileNameMaxCharacters: 200,
@@ -251,7 +251,8 @@ var TextEditor = /*#__PURE__*/function (_Component) {
251
251
  var _this$props5 = this.props,
252
252
  editorCallback = _this$props5.editorCallback,
253
253
  getRef = _this$props5.getRef,
254
- isCustomScroll = _this$props5.isCustomScroll;
254
+ isCustomScroll = _this$props5.isCustomScroll,
255
+ customCSS = _this$props5.customCSS;
255
256
  this.setState({
256
257
  isEditorLoad: true,
257
258
  isEditorShow: true
@@ -263,18 +264,6 @@ var TextEditor = /*#__PURE__*/function (_Component) {
263
264
  global.editor[id] = editorObj;
264
265
  }
265
266
 
266
- var css = 'pre {white-space: pre-wrap}',
267
- head = editorObj.doc.head || editorObj.doc.getElementsByTagName('head')[0],
268
- style = document.createElement('style');
269
- style.type = 'text/css';
270
-
271
- if (style.styleSheet) {
272
- style.styleSheet.cssText = css;
273
- } else {
274
- style.appendChild(editorObj.doc.createTextNode(css));
275
- }
276
-
277
- head.appendChild(style);
278
267
  editorCallback && editorCallback(editorObj);
279
268
  var iframe = (0, _selectn["default"])('iframe.contentDocument.body', editorObj) || null;
280
269
  var iframeHead = (0, _selectn["default"])('iframe.contentDocument.head', editorObj) || null;
@@ -292,9 +281,11 @@ var TextEditor = /*#__PURE__*/function (_Component) {
292
281
  iframe.classList.add('scroll');
293
282
  }
294
283
 
295
- var customFonts = document.createElement('style');
296
- customFonts.innerText = "@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}";
297
- iframeHead.appendChild(customFonts);
284
+ var customStyleTag = document.createElement('style');
285
+ var customizedCSS = "pre {white-space: pre-wrap} ".concat(customCSS);
286
+ var fontCSS = "@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}";
287
+ customStyleTag.innerText = "".concat(customizedCSS, " ").concat(fontCSS);
288
+ iframeHead.appendChild(customStyleTag);
298
289
  }
299
290
  }
300
291
  }, {
@@ -16,6 +16,7 @@ var defaultProps = {
16
16
  isNightMode: false,
17
17
  isReadOnly: false,
18
18
  dataSelectorId: 'textEditor',
19
+ customCSS: '',
19
20
  inlineImageProps: {
20
21
  allowedFileExtensions: ["jpeg", "jpg", "png", "gif", "bmp", "ico"],
21
22
  fileNameMaxCharacters: 200,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.0.0-temp-197.2",
3
+ "version": "1.0.0-temp-197.3",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "private": false,