Explorar o código

added addAttributes.

Yuto Iwata %!s(int64=7) %!d(string=hai) anos
pai
achega
a6a14092fa

+ 8 - 0
src/client/js/util/reveal/plugins/growi-renderer.js

@@ -13,6 +13,8 @@ import GrowiRenderer from '../../GrowiRenderer';
   let growiRendererPlugin = factory(growiRenderer);
   growiRendererPlugin.initialize();
 }(this, function(growiRenderer) {
+  const DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
+    DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';
   let marked;
 
   /**
@@ -93,6 +95,12 @@ import GrowiRenderer from '../../GrowiRenderer';
           .then(() => {
             section.innerHTML = context.parsedHTML;
           });
+        marked.addAttributes(   section, section, null, section.getAttribute( 'data-element-attributes' ) ||
+          section.parentNode.getAttribute( 'data-element-attributes' ) ||
+          DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
+        section.getAttribute( 'data-attributes' ) ||
+          section.parentNode.getAttribute( 'data-attributes' ) ||
+          DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR);
 
         // If there were notes, we need to re-add them after
         // having overwritten the section's HTML

+ 1 - 0
src/client/js/util/reveal/plugins/markdown.js

@@ -375,6 +375,7 @@ export default function( marked ) {
     createMarkdownSlide: createMarkdownSlide,
     slidify: slidify,
     processSlides: processSlides,
+    addAttributes: addAttributes,
     convertSlides: convertSlides
   };
 }