Просмотр исходного кода

set initialized object to initArgs of TagContext constractor

Yuki Takei 7 лет назад
Родитель
Сommit
c7cc81d3e6

+ 1 - 1
packages/growi-commons/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "growi-commons",
   "name": "growi-commons",
-  "version": "4.0.0-beta3",
+  "version": "4.0.0-beta4",
   "description": "GROWI Commons Libraries",
   "description": "GROWI Commons Libraries",
   "keywords": [
   "keywords": [
     "growi"
     "growi"

+ 1 - 1
packages/growi-commons/src/plugin/model/tag-context.js

@@ -1,6 +1,6 @@
 class TagContext {
 class TagContext {
 
 
-  constructor(initArgs) {
+  constructor(initArgs = {}) {
     this.tagExpression = initArgs.tagExpression || null;
     this.tagExpression = initArgs.tagExpression || null;
     this.method = initArgs.method || null;
     this.method = initArgs.method || null;
     this.args = initArgs.args || null;
     this.args = initArgs.args || null;

+ 1 - 4
packages/growi-commons/src/plugin/util/custom-tag-utils.js

@@ -32,10 +32,7 @@ function findTagAndReplace(tagPattern, html, replace) {
     const args = (group2 || group4 || '').trim();
     const args = (group2 || group4 || '').trim();
 
 
     // create contexts
     // create contexts
-    const tagContext = new TagContext();
-    tagContext.tagExpression = tagExpression;
-    tagContext.method = method;
-    tagContext.args = args;
+    const tagContext = new TagContext({ tagExpression, method, args });
 
 
     if (replace != null) {
     if (replace != null) {
       return replace(tagContext);
       return replace(tagContext);