Advertisement
ennio21

Mobirise plugin documentation

May 31st, 2016
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.17 KB | None | 0 0
  1. ***********
  2. * Adicionar Componentes ao APP
  3. ***********
  4. 1. Create HTML file
  5. 1. Crie um arquivo HTML
  6. component-name.html
  7.  
  8. 2. Create preview image PNG (width = 250px)
  9. 2. Crie uma imagem de preview em PNG (largura = 250px)
  10. component-name.png
  11.  
  12. 3. Call public mobirize method
  13. 3. Chama o método publico do mobirize
  14. mbrApp.loadComponents({
  15. 'component-name': {
  16. // component params
  17. // parametros do componente
  18. },
  19. ...
  20. });
  21.  
  22.  
  23.  
  24.  
  25. ***********
  26. * Components (default)
  27. ***********
  28. mbrApp.loadComponents({
  29. 'component-name': {
  30. _group: 'Group Name',
  31. _noDrag: true,
  32. _params: {
  33. },
  34. paramName: 'param value',
  35. ...
  36. },
  37. ...
  38. })
  39.  
  40. Params:
  41. * _inherit : inherit template.html and params.js from another component
  42. * _group : place component to group
  43. * _noDrag : remove draggable icon from component block
  44. * _alwaysBottom : always bottom... like footer
  45. * _alwaysTop : always top... like menu
  46. * _global : will changed in all pages
  47. * _positionAbsolute : when component with absoulte position (like menu)
  48. * _once : allow to add component once
  49. * _autoPadding : add paddings to block (see content components)
  50. Usage:
  51. _autoPadding: 'namespace'
  52. It works with components, which have the same parameter 'namespace'
  53.  
  54. * _css : include custom styles "style.css"
  55. * _js : include custom script "script.js"
  56. * _params : parameters that are set in the sidebar on the right
  57. * paramName : custom parameters (custom name, custom value)
  58. * ... : unlimited custom parameters and components :)
  59.  
  60. Filters:
  61. * _onParamsShow: : called when params panel show
  62. Usage:
  63. _onParamsShow: function(e, $params, $block) {
  64. // see how it used in Slider component
  65. }
  66.  
  67. * _onParamsFocus : called when some inputs in params focused
  68. Usage
  69. _onParamsFocus: function($item, $block) {
  70. // see how it used in Slider component
  71. }
  72.  
  73. * _onParamsChange : called when some params changed
  74. Usage
  75. _onParamsChange: function($item, paramName, paramValue) {
  76. //
  77. }
  78.  
  79. * _onRender : called before rendering of component
  80. If the function returns false, component is not rendering
  81. Usage:
  82. _onParamsChange: function($item, paramName, paramValue, renderFunc) {
  83. //
  84. }
  85.  
  86. * _publishFilter : filter for change publish component html code
  87. Usage:
  88. _publishFilter: function(html) {
  89. return html;
  90. }
  91.  
  92.  
  93.  
  94. ***********
  95. * Parameters (_params)
  96. ***********
  97. You can use switchers, selectors, checkboxes, inputs, image file dialogs and lists to set up your parameters
  98.  
  99. * Separator
  100. uniqueName: {
  101. type: 'separator',
  102. title: 'Title'
  103. }
  104.  
  105. * Switch
  106. paramName: {
  107. type: 'switch',
  108. title: 'Title',
  109. default: true
  110. }
  111.  
  112. * Switch Off
  113. // When switcher is ON will return FALSE
  114. paramName: {
  115. type: 'switch-off',
  116. title: 'Title',
  117. default: true
  118. }
  119.  
  120. * Text
  121. paramName: {
  122. type: 'text',
  123. title: 'Title',
  124. default: ''
  125. }
  126.  
  127. * Textarea
  128. paramName: {
  129. type: 'textarea',
  130. title: 'Title',
  131. default: ''
  132. }
  133.  
  134. * Image File Dialog
  135. paramName: {
  136. type: 'image',
  137. title: 'Title',
  138. default: 'images/bg.jpg'
  139. }
  140.  
  141. * Radio
  142. paramName: {
  143. type: 'radio',
  144. title: 'Title',
  145. name: 'uniqName',
  146. default: true
  147. },
  148. paramName2: {
  149. type: 'radio',
  150. title: 'Title 2',
  151. name: 'uniqName',
  152. default: false
  153. }
  154.  
  155. * Checkbox
  156. paramName: {
  157. type: 'check',
  158. title: 'Title',
  159. default: ['val1', 'val4'],
  160. values: {
  161. val1: 'Value 1',
  162. val2: 'Value 2',
  163. val3: 'Value 3',
  164. val4: 'Value 4'
  165. }
  166. }
  167.  
  168. * Select
  169. paramName: {
  170. type: 'select',
  171. title: 'Title',
  172. default: 'red',
  173. values: {
  174. // name: title
  175. red : 'Red',
  176. black : 'Black'
  177. }
  178. }
  179.  
  180. * Color
  181. paramName: {
  182. type: 'color',
  183. title: 'Title',
  184. default: '#FFF'
  185. }
  186.  
  187. * Range
  188. paramName: {
  189. type: 'range',
  190. title: 'Title',
  191. min: 0,
  192. max: 100,
  193. step: 10,
  194. default: 20
  195. }
  196.  
  197. * Video
  198. paramName: {
  199. type: 'video',
  200. title: 'Title',
  201. default: {
  202. url: 'http://www.youtube.com/embed/51OgzAzopqI',
  203. aspectratio: '16:9',
  204. autoplay: false,
  205. loop: false
  206. }
  207. }
  208.  
  209. * List (navigation example)
  210. paramName: {
  211. type: 'list',
  212. title: 'Title',
  213. default: [
  214. {title: 'Home', href: '#', active: true, some: true},
  215. {title: 'About', href: '#about', active: false, some: false},
  216. {title: 'Contact', href: '#contact', active: false, some: false}
  217. ],
  218. values: {
  219. title: 'text',
  220. href: 'text',
  221. active: 'check',
  222. some: 'switch'
  223. }
  224. }
  225.  
  226.  
  227. ***********
  228. * Parameters Conditions
  229. ***********
  230. Each parameter may have condition. Example:
  231. _params: {
  232. fistParam: {
  233. type: 'switch',
  234. title: 'Title',
  235. default: true
  236. },
  237. secondParam: {
  238. type: 'text',
  239. title: 'Title',
  240. default: 'Default',
  241. condition: ['fistParam']
  242. }
  243. }
  244.  
  245. secondParam will be shown when fistParam switcher enabled.
  246.  
  247.  
  248. ***********
  249. * Parameters example (_params)
  250. ***********
  251. First of all, see Mustache documentation to use params values in HTML - https://github.com/janl/mustache.js
  252.  
  253. * Switch
  254. // JS
  255. mbrApp.loadComponents({
  256. 'component-name': {
  257. _group: 'Group Name',
  258. _params: {
  259. paramName: {
  260. type: 'switch',
  261. title: 'Title',
  262. default: true
  263. }
  264. }
  265. }
  266. })
  267.  
  268. // HTML
  269. <div>
  270. paramName: {{_params.paramName}}
  271.  
  272. {{#_params.paramName}}
  273. Show only if paramName = true
  274. {{/_params.paramName}}
  275. </div>
  276.  
  277.  
  278. * Text
  279. // JS
  280. mbrApp.loadComponents({
  281. 'component-name': {
  282. _group: 'Group Name',
  283. _params: {
  284. myName: {
  285. type: 'text',
  286. title: 'My Name',
  287. default: 'Mobirize'
  288. }
  289. }
  290. }
  291. })
  292.  
  293. // HTML
  294. <div>
  295. My name is {{{_params.myName}}}
  296. </div>
  297.  
  298.  
  299. * File Dialog
  300. // JS
  301. mbrApp.loadComponents({
  302. 'component-name': {
  303. _group: 'Group Name',
  304. _params: {
  305. image: {
  306. type: 'image',
  307. title: 'Image',
  308. default: 'images/bg.jpg'
  309. }
  310. }
  311. }
  312. })
  313.  
  314. // HTML
  315. <div>
  316. <img src="{{{_params.image}}}" alt="">
  317. </div>
  318.  
  319. * Checkbox
  320. // JS
  321. mbrApp.loadComponents({
  322. 'component-name': {
  323. _group: 'Group Name',
  324. _params: {
  325. paramName: {
  326. type: 'check',
  327. title: 'Title',
  328. default: ['val1', 'val4'],
  329. values: {
  330. val1: 'Value 1',
  331. val2: 'Value 2',
  332. val3: 'Value 3',
  333. val4: 'Value 4'
  334. }
  335. }
  336. }
  337. }
  338. })
  339.  
  340. // HTML
  341. <ul>
  342. {{#_params.paramName}}
  343. <li>
  344. {{.}}
  345. </li>
  346. {{/_params.paramName}}
  347. </ul>
  348.  
  349. * Select
  350. // JS
  351. mbrApp.loadComponents({
  352. 'component-name': {
  353. _group: 'Group Name',
  354. _params: {
  355. gender: {
  356. type: 'select',
  357. title: 'Gender',
  358. default: 'red',
  359. values: {
  360. women : 'Women',
  361. man : 'Man',
  362. other : 'Other'
  363. }
  364. }
  365. }
  366. }
  367. })
  368.  
  369. // HTML
  370. <div>
  371. Gender: {{_params.gender}}
  372. </div>
  373.  
  374. * Video
  375. // JS
  376. mbrApp.loadComponents({
  377. 'component-name': {
  378. _group: 'Group Name',
  379. _params: {
  380. video: {
  381. type: 'video',
  382. title: 'My Video',
  383. default: {
  384. url: 'http://www.youtube.com/embed/51OgzAzopqI',
  385. aspectratio: '16:9',
  386. autoplay: false,
  387. loop: false
  388. }
  389. }
  390. }
  391. }
  392. })
  393.  
  394. // HTML
  395. <iframe width="{{_params.video.width}}" height="{{_params.video.height}}" src="{{_params.video.url}}" frameborder="0" allowfullscreen></iframe>
  396.  
  397. * List (navigation example)
  398. // JS
  399. mbrApp.loadComponents({
  400. 'component-name': {
  401. _group: 'Group Name',
  402. _params: {
  403. listEx: {
  404. type: 'list',
  405. title: 'List example',
  406. default: [
  407. {title: 'Home', href: '#', active: true},
  408. {title: 'About', href: '#about', active: false},
  409. {title: 'Contact', href: '#contact', active: false}
  410. ],
  411. values: {
  412. title: 'text',
  413. href: 'text',
  414. active: 'check'
  415. }
  416. }
  417. }
  418. }
  419. })
  420.  
  421. // HTML
  422. <ul>
  423. {{#_params.listEx}}
  424. <li{{#active}} class="active"{{/active}}>
  425. <a href="{{href}}">{{{title}}}</a>
  426. </li>
  427. {{/_params.listEx}}
  428. </ul>
  429.  
  430.  
  431.  
  432. ***********
  433. * Parameters (custom)
  434. ***********
  435. You can use custom parameters as you can
  436.  
  437. // JS
  438. mbrApp.loadComponents({
  439. 'component-name': {
  440. _group: 'Group Name',
  441. myParam: 'Value'
  442. }
  443. })
  444.  
  445. // HTML
  446. <div>
  447. My custom param value: {{myParam}}
  448. </div>
  449.  
  450.  
  451.  
  452.  
  453.  
  454. ***********
  455. * Custom CSS & JS
  456. ***********
  457. You can add style.css and script.js for each of components
  458.  
  459. Example: see 'menu' component
  460.  
  461. Example:
  462. mbrApp.loadComponents({
  463. 'componentName': {
  464. _css: true,
  465. _js: true,
  466. ...
  467. }
  468. })
  469.  
  470. And add this new files:
  471. components/componentName/style.css
  472. components/componentName/script.js
  473.  
  474.  
  475.  
  476.  
  477. ***********
  478. * Custom Elements
  479. ***********
  480. // Buttons
  481. <div class="group">
  482. <a data-app-btn="true" href="http://mobirise.com" class="btn btn-info btn-lg">
  483. Sign up today
  484. </a>
  485. <a data-app-btn="true" class="btn btn-lg btn-default" href="http://mobirise.com">
  486. Learn more
  487. </a>
  488. </div>
  489.  
  490.  
  491. // images
  492. <img data-app-edit="image:img1" src="{{img1}}" alt="">
  493.  
  494.  
  495.  
  496.  
  497. ***********
  498. * Inherit Components
  499. ***********
  500. You can inherit template.html and params.js for your new component block from one of default components
  501.  
  502. Example params.js:
  503. mbrApp.loadComponents({
  504. 'myNewComponent': {
  505. _inherit: 'inheritComponent',
  506. _params: {
  507. showText: false,
  508. bgColor: '#fff'
  509. },
  510. text: 'New Text'
  511. }
  512. })
  513.  
  514. Examples:
  515. header2 inherited from header1
  516. msg-box2 inherited from msg-box
  517.  
  518.  
  519.  
  520.  
  521. ***********
  522. * Toolbar Options
  523. ***********
  524. You can remove some buttons from Summernote toolbar
  525.  
  526. Available names for Text:
  527. mbrAlign
  528. mbrLink
  529. mbrFonts
  530. mbrFontSize
  531. mbrColor
  532. bold
  533. italic
  534. Available names for Buttons:
  535. mbrLink
  536. mbrFonts
  537. mbrColor
  538. mbrFontSize
  539. mbrBtnColor
  540. mbrBtnMove
  541. mbrBtnAdd
  542. mbrBtnRemove
  543.  
  544. Example (remove mbrBtnMove):
  545. <div class="group" data-app-edit="buttons:buttons" data-toolbar="-mbrBtnMove">
  546. {{{buttons}}}
  547. </div>
  548.  
  549. Example (remove mbrFonts and mbrLink):
  550. <div class="hero" data-app-edit="content:text" data-toolbar="-mbrLink,-mbrFonts">
  551. {{{text}}}
  552. </div>
  553.  
  554.  
  555.  
  556. ***********
  557. * Enable multiline content (for new paragraph using <p>...</p> instead of <br>)
  558. ***********
  559. Example
  560. <div class="mbr-article"
  561. data-app-edit="content:text" data-multiline
  562. data-app-placeholder="Content">{{{text}}}</div>
  563.  
  564.  
  565.  
  566. ***********
  567. * Custom Selectors for additional styles (font/color)
  568. ***********
  569. Example
  570. <h2 class="mbr-section__header" data-app-edit="content:header" data-app-selector=".mbr-section__header">{{{header}}}</h2>
  571.  
  572.  
  573.  
  574.  
  575. ***********
  576. * Editable Area Placeholders
  577. ***********
  578. You can set placeholder text for editable area (when text inside removed - placeholder showed up)
  579.  
  580. Example (from menu component)
  581. <span data-app-edit="content:brand" data-app-placeholder="Brand Name">
  582. {{{brand}}}
  583. </span>
  584.  
  585.  
  586.  
  587.  
  588. ***********
  589. * Extended Toolbar
  590. ***********
  591. If you want to use extended toolbar (with lists/styles/etc) use data-app-edit="full:..."
  592.  
  593. Example:
  594. <p data-app-edit="full:text" data-app-placeholder="Text">{{{text}}}</p>
  595.  
  596.  
  597.  
  598. ***********
  599. * Mobirize atributes for templates
  600. ***********
  601. mbr-id="_anchor"
  602. mbr-class-mbr-background="_params.paramName"
  603. mbr-class-mbr-parallax-background="_params.paramName"
  604. mbr-bg-image="_params.paramName"
  605. mbr-bg-color="_params.paramName"
  606. mbr-html="_params.paramName"
  607. mbr-if="_params.paramName"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement