@pubann/textae 13.11.0

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.
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ TextAE
2
+ ======
3
+
4
+ *An embeddable, web-based visual editor of text annotation*
5
+
6
+
7
+ homepage
8
+ --------
9
+
10
+ http://textae.pubannotation.org/
11
+
12
+ Usage
13
+ -----
14
+
15
+ ### Using as an npm package
16
+
17
+ You can also use `textae` as an npm package in your project.
18
+
19
+ #### Installation
20
+
21
+ To install the package, run the following command:
22
+
23
+ ```bash
24
+ npm install textae
25
+ ```
26
+ #### How to Use in HTML
27
+ To use TextAE in your HTML, follow these steps:
28
+
29
+ 1. Include the stylesheet and script
30
+
31
+ Add the following lines to your `<head>` section to load the TextAE CSS and JS from your `node_modules` directory:
32
+
33
+ ```html
34
+ <link rel="stylesheet" href="node_modules/textae/dist/lib/css/textae-13.10.0.min.css">
35
+ <script src="node_modules/textae/dist/lib/textae-13.10.0.min.js"></script>
36
+ ```
37
+ 2. Prepare the container
38
+ Add a `<div>` element with the class `textae-editor` to your HTML.
39
+ This is the element where the TextAE editor will be rendered.
40
+
41
+ ```html
42
+ <div class="textae-editor" title="Example Editor" mode="edit"></div>
43
+ ```
44
+
45
+ #### Example HTML
46
+ Here is an example of how to use textae in an HTML file:
47
+
48
+ ```html
49
+ <!DOCTYPE html>
50
+ <html lang="en">
51
+ <head>
52
+ <meta charset="UTF-8">
53
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
54
+ <title>TextAE Example</title>
55
+ <link rel="stylesheet" href="node_modules/textae/dist/lib/css/textae-13.10.0.min.css">
56
+ <script src="node_modules/textae/dist/lib/textae-13.10.0.min.js"></script>
57
+ </head>
58
+ <body>
59
+ <div class="textae-editor" title="Example Editor" mode="edit"></div>
60
+ </body>
61
+ </html>
62
+ ```
63
+
64
+ ## parameters
65
+
66
+ This editor is customizable by html attributes.
67
+
68
+ ### source
69
+
70
+ Set the url of an annotations json.
71
+
72
+ Example:
73
+ ```html
74
+ <div class="textae-editor" source="./annotations.json" ></div>
75
+ ```
76
+
77
+ ### config
78
+
79
+ Set the url of a config json.
80
+
81
+ Example:
82
+ ```html
83
+ <div class="textae-editor" config="./config.json" ></div>
84
+ ```
85
+
86
+ ### autocompletion_ws
87
+
88
+ Set the url of the autocompletion web service.
89
+
90
+ Example:
91
+ ```html
92
+ <div class="textae-editor" autocompletion_ws="/autocomplete?order=desc"></div>
93
+ ```
94
+
95
+ ### mode
96
+
97
+ Set default edit mode.
98
+ values:
99
+
100
+ - view (default)
101
+ - edit
102
+
103
+ Example:
104
+
105
+ ```html
106
+ <div class="textae-editor" mode="edit"></div>
107
+ ```
108
+
109
+ ### control
110
+
111
+ Show the control bar of the editor.
112
+
113
+ - auto (default) : Show the control bar in edit mode
114
+ - visible : Show the control bar always
115
+ - hidden : Do not show the control bar always
116
+
117
+ Example:
118
+ ```html
119
+ <div class="textae-editor" control="visible" ></div>
120
+ ```
121
+
122
+ ### status_bar
123
+
124
+ Show the status bar of the editor.
125
+ When the value is 'on', show the status bar.
126
+ the status bar is not shown at default.
127
+
128
+ Example:
129
+ ```html
130
+ <div class="textae-editor" status_bar="on" ></div>
131
+ ```
132
+
133
+ ## For development
134
+
135
+ ### Preparation
136
+
137
+ [Node.js](https://nodejs.org) is required to be installed on your system.
138
+
139
+ * To clone the project and get into the directory
140
+ ```
141
+ git clone git@github.com:pubannotation/textae.git
142
+ cd textae/
143
+ ```
144
+
145
+ * To install the required npm packages (which are specified in 'package.json').
146
+ ```
147
+ npm install
148
+ ```
149
+
150
+ ### Development
151
+
152
+ * To open in your browser the file 'dev/development.html' through 'http://localhost:8000', for development
153
+ ```
154
+ npm run watch
155
+ ```
156
+
157
+ * If the file does not open automatically, click [here](http://localhost:8000/dev/development.html).
158
+
159
+ * For development, your editions are supposed to be made to the files in the 'src' directory.
160
+
161
+
162
+ ### Build
163
+
164
+ * To compile the files for distribution into the dictionary 'dist'.
165
+
166
+ ```
167
+ npm run dist
168
+ ```
169
+
170
+
171
+ Contributors (so far)
172
+ ---------------------
173
+
174
+ - Jin-Dong Kim ([DBCLS](http://dbcls.rois.ac.jp/en/))
175
+ - Yue Wang ([DBCLS](http://dbcls.rois.ac.jp/en/))
176
+ - Shigeru Nakajima ([Luxiar](http://www.luxiar.com/))
177
+ - Masahiro Nakashima ([YouWorks](https://youworks.jp/))
178
+
179
+ License
180
+ -------
181
+
182
+ Released under [MIT license](http://opensource.org/licenses/MIT).
package/package.json ADDED
@@ -0,0 +1,129 @@
1
+ {
2
+ "name": "@pubann/textae",
3
+ "description": "text annotation editor",
4
+ "version": "13.11.0",
5
+ "author": "jdkim",
6
+ "bugs": {
7
+ "url": "https://github.com/pubannotation/textae/issues"
8
+ },
9
+ "dependencies": {
10
+ "@codemirror/lang-javascript": "^6.2.4",
11
+ "@codemirror/language": "^6.11.0",
12
+ "@codemirror/legacy-modes": "^6.5.1",
13
+ "ajv": "^8.17.1",
14
+ "ajv-formats": "3.0.1",
15
+ "ajv-keywords": "^5.1.0",
16
+ "alertifyjs": "1.14.0",
17
+ "array-move": "4.0.0",
18
+ "codemirror": "^6.0.1",
19
+ "debounce": "2.2.0",
20
+ "delegate": "3.2.0",
21
+ "dohtml": "0.1.0",
22
+ "dropzone": "5.9.3",
23
+ "font-awesome": "4.7.0",
24
+ "jquery": "^3.7.1",
25
+ "jquery-ui": "^1.14.1",
26
+ "jsondiffpatch": "0.7.3",
27
+ "lodash.escape": "4.0.1",
28
+ "observ": "0.2.0",
29
+ "path-browserify": "1.0.1",
30
+ "popover-autocomplete": "^1.0.1",
31
+ "@pubann/simple-inline-text-annotation": "^1.1.1",
32
+ "sticky-js": "1.3.0",
33
+ "throttleit": "^2.1.0",
34
+ "uuid": "^11.1.0"
35
+ },
36
+ "devDependencies": {
37
+ "@eslint/eslintrc": "^3.3.1",
38
+ "@eslint/js": "^9.27.0",
39
+ "clean-css-cli": "^5.6.3",
40
+ "connect": "3.7.0",
41
+ "cpx2": "^8.0.0",
42
+ "eslint": "^9.27.0",
43
+ "eslint-config-prettier": "^10.1.5",
44
+ "eslint-plugin-unused-imports": "^4.1.4",
45
+ "globals": "^16.1.0",
46
+ "husky": "^9.1.7",
47
+ "less": "^4.3.0",
48
+ "less-watch-compiler": "1.16.3",
49
+ "lint-staged": "^16.0.0",
50
+ "mkdirp": "3.0.1",
51
+ "npm-run-all": "4.1.5",
52
+ "open-cli": "^8.0.0",
53
+ "prettier": "^3.5.3",
54
+ "replace-in-file": "^8.3.0",
55
+ "rimraf": "6.0.1",
56
+ "serve-favicon": "2.5.0",
57
+ "serve-static": "^2.2.0",
58
+ "source-map-loader": "^5.0.0",
59
+ "standard-version": "^9.5.0",
60
+ "terser-webpack-plugin": "^5.3.14",
61
+ "webpack": "^5.99.9",
62
+ "webpack-cli": "^6.0.1"
63
+ },
64
+ "files": [
65
+ "dist/lib/textae-{{version}}.js",
66
+ "dist/lib/textae-{{version}}.min.js",
67
+ "dist/lib/css/textae-{{version}}.css",
68
+ "dist/lib/css/textae-{{version}}.min.css",
69
+ "scripts/postinstall.js"
70
+ ],
71
+ "homepage": "https://github.com/pubannotation/textae",
72
+ "keywords": [
73
+ "DBCLS",
74
+ "annotation",
75
+ "javascript"
76
+ ],
77
+ "license": "MIT",
78
+ "lint-staged": {
79
+ "*.js": [
80
+ "eslint --fix",
81
+ "prettier --write"
82
+ ],
83
+ "*.json": [
84
+ "prettier --write"
85
+ ],
86
+ "*.less": [
87
+ "prettier --write"
88
+ ],
89
+ "userAcceptanceTest/**/*.md": [
90
+ "prettier --write"
91
+ ]
92
+ },
93
+ "main": "src/development.html",
94
+ "repository": {
95
+ "type": "git",
96
+ "url": "https://github.com/pubannotation/textae.git"
97
+ },
98
+ "scripts": {
99
+ "dev:open": "open-cli 'http://localhost:3001/dev/development.html?annotation=%7B%22text%22%3A%22%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%82%8F%22%2C%22denotations%22%3A%5B%7B%22span%22%3A%7B%22begin%22%3A0%2C%22end%22%3A5%7D%2C%22obj%22%3A%22%E6%8C%A8%E6%8B%B6%22%7D%5D%7D'",
100
+ "dev:server": "node dev/development-sever.js",
101
+ "dev:watch": "webpack --config webpack.dev.js",
102
+ "dev:watch-less": "less-watch-compiler src/lib/css src/lib/css textae.less",
103
+ "dist": "npm-run-all dist:clean dist:build dist:copy dist:replace:version",
104
+ "dist:build": "npm-run-all -p dist:build:**",
105
+ "dist:build:css": "npm-run-all dist:less dist:cleancss",
106
+ "dist:build:js": "npm-run-all dist:lint dist:bundle",
107
+ "dist:bundle": "webpack --config webpack.prod.js",
108
+ "dist:clean": "rimraf dist/* tmp/$npm_package_name-*.js tmp/$npm_package_name-*.min.js tmp/css/textae-*.css",
109
+ "dist:cleancss": "cleancss -o tmp/css/$npm_package_name-$npm_package_version.min.css tmp/css/$npm_package_name-$npm_package_version.css",
110
+ "dist:copy": "npm-run-all -p dist:copy:**",
111
+ "dist:copy:app": "cpx src/app/editor.html dist",
112
+ "dist:copy:css": "cpx tmp/css/$npm_package_name-$npm_package_version'*'.css dist/lib/css",
113
+ "dist:copy:demo": "cpx 'src/demo/**' dist/demo",
114
+ "dist:copy:fonts": "cpx 'src/lib/fonts/**' dist/lib/fonts",
115
+ "dist:copy:images": "cpx 'src/lib/css/images/**.png' dist/lib/css/images",
116
+ "dist:copy:js": "cpx tmp/$npm_package_name-$npm_package_version'*'.js dist/lib",
117
+ "dist:less": "lessc 'src/lib/css/textae.less' tmp/css/$npm_package_name-$npm_package_version.css",
118
+ "dist:lint": "npx prettier --check 'src/lib/**/*.js' 'src/lib/css/*.less' && eslint src/lib",
119
+ "dist:replace:version": "replace-in-file /{{version}}/g $npm_package_version dist/editor.html,dist/demo/**/*.html --isRegex",
120
+ "postinstall": "node ./scripts/postinstall.js",
121
+ "release": "standard-version -a",
122
+ "watch": "npm-run-all -p dev:watch dev:watch-less dev:server dev:open"
123
+ },
124
+ "standard-version": {
125
+ "scripts": {
126
+ "postbump": "npm run dist && git add -A dist"
127
+ }
128
+ }
129
+ }
@@ -0,0 +1,27 @@
1
+ // Only run postinstall when executing npm install in this project (during development).
2
+ // npm sets the directory where the npm command was initially executed as the environment variable INIT_CWD.
3
+ // When running npm install within this project, INIT_CWD and the current directory (process.cwd()) are identical.
4
+ // When installed as a library in other projects, the current directory becomes a subdirectory under node_modules, and thus the two values will not match.
5
+ if (process.env.INIT_CWD !== process.cwd()) {
6
+ console.log('Postinstall script skipped: installed as a library.')
7
+ process.exit(0)
8
+ }
9
+
10
+ const { execSync } = require('child_process')
11
+ const { copySync } = require('cpx2')
12
+
13
+ try {
14
+ console.log('Running husky installation...')
15
+ execSync('npx husky', { stdio: 'inherit' })
16
+
17
+ console.log('Copying Font Awesome fonts...')
18
+ copySync('node_modules/font-awesome/fonts/**', 'src/lib/fonts', {
19
+ clean: true
20
+ })
21
+
22
+ console.log('Postinstall scripts completed successfully.')
23
+ process.exit(0)
24
+ } catch (error) {
25
+ console.error('Postinstall scripts failed:', error)
26
+ process.exit(1)
27
+ }