New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jsreport/jsreport-assets

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsreport/jsreport-assets - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

2

lib/worker.js
const util = require('util')
const asyncReplace = util.promisify(require('async-replace'))
const asyncReplace = util.promisify(require('async-replace-with-limit'))
const { readAsset } = require('./assetsShared')

@@ -4,0 +4,0 @@ const test = /{#asset ([^{}]{0,500})}/g

{
"name": "@jsreport/jsreport-assets",
"version": "3.3.0",
"version": "3.4.0",
"description": "jsreport extension embedding static assets like fonts or helpers into the templates",

@@ -34,3 +34,3 @@ "keywords": [

"@jsreport/office": "3.0.0",
"async-replace": "1.0.1",
"async-replace-with-limit": "2.0.0",
"enhanced-resolve": "5.8.2",

@@ -45,5 +45,5 @@ "etag": "1.8.1",

"devDependencies": {
"@jsreport/jsreport-core": "3.4.0",
"@jsreport/jsreport-express": "3.3.0",
"@jsreport/jsreport-handlebars": "3.0.0",
"@jsreport/jsreport-core": "3.5.0",
"@jsreport/jsreport-express": "3.4.0",
"@jsreport/jsreport-handlebars": "3.1.0",
"@jsreport/jsreport-jsrender": "3.0.0",

@@ -50,0 +50,0 @@ "@jsreport/jsreport-scripts": "3.2.0",

@@ -11,2 +11,7 @@ # @jsreport/jsreport-assets

### 3.4.0
- fix asset link click from xlsx template preview
- update to improve the display of templates with xlsx in studio
### 3.3.0

@@ -13,0 +18,0 @@

import React, { Component } from 'react'
import AssetUploadButton from './AssetUploadButton.js'
import Studio, { FramePreview, TextEditor } from 'jsreport-studio'
import Studio, { templateEditorModeResolvers, SplitPane, FramePreview, TextEditor } from 'jsreport-studio'
import superagent from 'superagent'

@@ -11,3 +11,3 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'

// Studio.api currently always open dialogs on failures and that is what we don't want, so arbitrary implementaiton here
// Studio.api currently always open dialogs on failures and that is what we don't want, so arbitrary implementation here
const getTextFromApi = (path) => {

@@ -24,5 +24,11 @@ return new Promise((resolve, reject) => {

const defaultCodeActive = (
props.entity == null &&
props.codeEntity != null &&
Object.prototype.hasOwnProperty.call(props.codeEntity, 'content')
)
this.state = {
initialLoading: true,
helpersActive: false,
codeActive: defaultCodeActive,
previewOpen: false,

@@ -199,3 +205,3 @@ previewLoading: false

previewOpen: true,
helpersActive: false
codeActive: false
})

@@ -238,4 +244,4 @@ }

renderEditorToolbar () {
const { link, previewLoading, previewOpen, helpersActive } = this.state
const { entity, helpersEntity, displayName, icon, onDownload, onUpload } = this.props
const { link, previewLoading, previewOpen, codeActive } = this.state
const { entity, codeEntity, displayName, icon, onDownload, onUpload } = this.props
const lazyPreview = this.getLazyPreviewStatus(entity)

@@ -343,9 +349,9 @@ const previewEnabled = this.getPreviewEnabledStatus(entity)

)}
{helpersEntity != null && (
{codeEntity != null && (
<button
className={`button ${helpersActive ? 'danger' : 'confirmation'}`}
className={`button ${codeActive ? 'danger' : 'confirmation'}`}
onClick={() => this.setState((state) => {
const change = {}
if (state.helpersActive) {
if (state.codeActive) {
Studio.store.dispatch(Studio.entities.actions.flushUpdates())

@@ -358,5 +364,5 @@ } else {

return { helpersActive: !state.helpersActive, ...change }
return { codeActive: !state.codeActive, ...change }
})}
title={`${helpersActive ? 'Hide' : 'Show'} helpers`}
title={`${codeActive ? 'Hide' : 'Show'} ${codeEntity.content != null ? 'content and helpers' : 'helpers'}`}
>

@@ -377,16 +383,39 @@ <i className='fa fa-code' />

renderEditorContent () {
const { entity, helpersEntity, emptyMessage, getPreviewContent, onUpdate } = this.props
const { helpersActive } = this.state
const { entity, codeEntity, emptyMessage, getPreviewContent, onUpdate } = this.props
const { codeActive } = this.state
if (helpersEntity != null && helpersActive) {
return (
if (codeEntity != null && codeActive) {
const helpersEditor = (
<TextEditor
key={helpersEntity._id + '_helpers'}
name={helpersEntity._id + '_helpers'}
getFilename={() => `${helpersEntity.name} (helpers)`}
key={codeEntity._id + '_helpers'}
name={codeEntity._id + '_helpers'}
getFilename={() => `${codeEntity.name} (helpers)`}
mode='javascript'
onUpdate={(v) => onUpdate(Object.assign({ _id: helpersEntity._id }, { helpers: v }))}
value={helpersEntity.helpers || ''}
onUpdate={(v) => onUpdate(Object.assign({ _id: codeEntity._id }, { helpers: v }))}
value={codeEntity.helpers || ''}
/>
)
if (Object.prototype.hasOwnProperty.call(codeEntity, 'content')) {
return (
<SplitPane
primary='second'
split='horizontal'
resizerClassName='resizer-horizontal'
defaultSize={(window.innerHeight * 0.2) + 'px'}
>
<TextEditor
key={codeEntity._id}
name={codeEntity._id}
getFilename={() => codeEntity.name}
mode={resolveTemplateEditorMode(codeEntity) || 'handlebars'}
onUpdate={(v) => onUpdate(Object.assign({ _id: codeEntity._id }, { content: v }))}
value={codeEntity.content || ''}
/>
{helpersEditor}
</SplitPane>
)
}
return helpersEditor
}

@@ -528,2 +557,14 @@

function resolveTemplateEditorMode (template) {
// eslint-disable-next-line
for (const k in templateEditorModeResolvers) {
const mode = templateEditorModeResolvers[k](template)
if (mode) {
return mode
}
}
return null
}
export default AssetEditor

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc