Skip to content

Webpack #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
6 changes: 4 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/node_modules
/src/stories
/src
.babelrc
webpack.config.js
/storybook-static
12 changes: 12 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions"
],
"framework": "@storybook/react"
}
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
65 changes: 56 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# pd-playground
# pdfmake-editor

### Install

```
npm i pdmake-editor
```
npm i pdfmake-editor

### Useage
### Use PdfEditor only

```javascript
import React from "react";
import PdfEditor from "pdfmake-editor
import PdfEditor from "pdfmake-editor";

const App = () => {
// initial code
Expand All @@ -19,22 +18,70 @@ const App = () => {
// code state
const [code, setCode] = React.useState(initialCode);

// code and setCode is necessary
// cmeditor is available default value is true. True mean use Codermirror.
// darktheme is available default value is false. Change the theme for Codermirror.
return (
<PdfEditor code={code} setCode={setCode} />
// <PdfEditor code={code} setCode={setCode} cmeditor={true} darktheme={false} />
};

export default App;
```

### Use provider

```javascript
import React from "react";
import { EditorProvider, EditorPlayground } from "pdfmake-editor";

const App = () => {
// initial code
const initialCode = 'dd = {content: "Hello "}';

// code state
const [code, setCode] = React.useState(initialCode);

// code and setCode is necessary
// cmeditor default value is true.
// darktheme default value is false.
return (
<EditorProvider code={code} setCode={setCode}>
<EditorPlayground />
</EditorProvider>
// <EditorProvider code={code} setCode={setCode} cmeditor={true} darktheme={true}>
// <EditorPlayground />
// </EditorProvider>
);
};

export default App;
```

### Version
#### Samples

Use sample by import `mapForms` and `samples` javascript object.

```javascript
import React from "react";
import { mapForms, samples } from "pdfmake-editor";
import PdfEditor from "pdfmake-editor";

const App = () => {
const [code, setCode] = React.useState(mapForms[Object.keys(mapForms)[0]]);
return <PdfEditor code={code} setCode={setCode} />;
};

export default App;
```

### Local development

pull the repository to local
cd to 'pd-playground' folder
Pull the repository to local
cd to 'pdfmake-editor' folder

```
npm i
npm link
```

Expand All @@ -47,5 +94,5 @@ npm link pdfmake-editor
When you finish test remember to unlink by use

```
npm unlink pd-playground
npm unlink pdfmake-editor
```
96 changes: 96 additions & 0 deletions build/index.js

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions build/index.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/

/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! pdfmake v0.2.6, @license MIT, @link http://pdfmake.org */

/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license MUI v5.10.16
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/

/** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Loading