update docs for infinite editing

This commit is contained in:
Mads Rasmussen
2018-12-11 13:03:18 +01:00
parent 0ae9d30373
commit d06ccebf7c
2 changed files with 155 additions and 220 deletions

View File

@@ -124,58 +124,6 @@
</tr>
</table>
<h1>Content Picker</h1>
Opens a content picker.</br>
<strong>view: </strong>contentpicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tr>
<td>model.multiPicker</td>
<td>Boolean</td>
<td>Pick one or multiple items</td>
</tr>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tr>
<td>model.selection</td>
<td>Array</td>
<td>Array of content objects</td>
</tr>
</table>
<h1>Icon Picker</h1>
Opens an icon picker.</br>
<strong>view: </strong>iconpicker
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tr>
<td>model.icon</td>
<td>String</td>
<td>The icon class</td>
</tr>
</table>
<h1>Item Picker</h1>
Opens an item picker.</br>
<strong>view: </strong>itempicker
@@ -220,170 +168,6 @@ Opens an item picker.</br>
</tr>
</table>
<h1>Macro Picker</h1>
Opens a media picker.</br>
<strong>view: </strong>macropicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.dialogData</td>
<td>Object</td>
<td>Object which contains array of allowedMacros. Set to <code>null</code> to allow all.</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.macroParams</td>
<td>Array</td>
<td>Array of macro params</td>
</tr>
<tr>
<td>model.selectedMacro</td>
<td>Object</td>
<td>The selected macro</td>
</tr>
</tbody>
</table>
<h1>Media Picker</h1>
Opens a media picker.</br>
<strong>view: </strong>mediapicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.multiPicker</td>
<td>Boolean</td>
<td>Pick one or multiple items</td>
</tr>
<tr>
<td>model.onlyImages</td>
<td>Boolean</td>
<td>Only display files that have an image file-extension</td>
</tr>
<tr>
<td>model.disableFolderSelect</td>
<td>Boolean</td>
<td>Disable folder selection</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.selectedImages</td>
<td>Array</td>
<td>Array of selected images</td>
</tr>
</tbody>
</table>
<h1>Member Group Picker</h1>
Opens a member group picker.</br>
<strong>view: </strong>membergrouppicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.multiPicker</td>
<td>Boolean</td>
<td>Pick one or multiple items</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.selectedMemberGroup</td>
<td>String</td>
<td>The selected member group</td>
</tr>
<tr>
<td>model.selectedMemberGroups (multiPicker)</td>
<td>Array</td>
<td>The selected member groups</td>
</tr>
</tbody>
</table>
<h1>Member Picker</h1>
Opens a member picker. </br>
<strong>view: </strong>memberpicker
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.multiPicker</td>
<td>Boolean</td>
<td>Pick one or multiple items</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Returns</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>model.selection</td>
<td>Array</td>
<td>Array of selected members/td>
</tr>
</tbody>
</table>
<h1>YSOD</h1>
Opens an overlay to show a custom YSOD. </br>
<strong>view: </strong>ysod

View File

@@ -4,6 +4,76 @@
*
* @description
* Added in Umbraco 8.0. Application-wide service for handling infinite editing.
*
*
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<button type="button" ng-click="vm.open()">Open</button>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.open = open;
function open() {
var mediaPickerOptions = {
multiPicker: true,
submit: function(model) {
editorService.close();
},
close: function() {
editorService.close();
}
}
editorService.mediaPicker(mediaPickerOptions);
};
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
<h3>Custom view example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.open = open;
function open() {
var options = {
view: "path/to/view.html"
submit: function(model) {
editorService.close();
},
close: function() {
editorService.close();
}
}
editorService.open(options);
};
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
*/
(function () {
"use strict";
@@ -43,6 +113,10 @@
*
* @description
* Method to open a new editor in infinite editing
*
* @param {Object} editor rendering options
* @param {String} editor.view Path to view
* @param {String} editor.size Sets the size of the editor ("Small"). If nothing is set it will use full width.
*/
function open(editor) {
@@ -108,8 +182,12 @@
*
* @description
* Opens a media editor in infinite editing, the submit callback returns the updated content item
* @param {Object} editor rendering options
* @param {String} editor.id The id of the content item
* @param {Boolean} editor.create Create new content item
* @param {Function} editor.submit Callback function when the publish and close button is clicked. Returns the editor model object
* @param {Function} editor.close Callback function when the close button is clicked.
*
* @returns {Object} editor object
*/
function contentEditor(editor) {
@@ -124,6 +202,12 @@
*
* @description
* Opens a content picker in infinite editing, the submit callback returns an array of selected items
*
* @param {Object} editor rendering options
* @param {Boolean} editor.multiPicker Pick one or multiple items
* @param {Function} editor.submit Callback function when the submit button is clicked. Returns the editor model object
* @param {Function} editor.close Callback function when the close button is clicked.
*
* @returns {Object} editor object
*/
function contentPicker(editor) {
@@ -218,11 +302,13 @@
*
* @description
* Opens an embed editor in infinite editing.
* @param {Object} editor rendering options
* @param {String} editor.icon The icon class
* @param {String} editor.color The color class
* @param {Callback} editor.submit Saves, submits, and closes the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
*/
function linkPicker(editor) {
editor.view = "views/common/infiniteeditors/linkpicker/linkpicker.html";
editor.size = "small";
@@ -236,6 +322,7 @@
*
* @description
* Opens a media editor in infinite editing, the submit callback returns the updated media item
* @param {Object} editor rendering options
* @param {String} editor.id The id of the media item
* @param {Boolean} editor.create Create new media item
* @param {Callback} editor.submit Saves, submits, and closes the editor
@@ -254,6 +341,7 @@
*
* @description
* Opens a media picker in infinite editing, the submit callback returns an array of selected media items
* @param {Object} editor rendering options
* @param {Boolean} editor.multiPicker Pick one or multiple items
* @param {Boolean} editor.onlyImages Only display files that have an image file-extension
* @param {Boolean} editor.disableFolderSelect Disable folder selection
@@ -276,6 +364,7 @@
*
* @description
* Opens an icon picker in infinite editing, the submit callback returns the selected icon
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
@@ -293,6 +382,7 @@
*
* @description
* Opens the document type editor in infinite editing, the submit callback returns the saved document type
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
@@ -309,6 +399,7 @@
*
* @description
* Opens the media type editor in infinite editing, the submit callback returns the saved media type
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
@@ -318,24 +409,75 @@
open(editor);
}
/**
* @ngdoc method
* @name umbraco.services.editorService#queryBuilder
* @methodOf umbraco.services.editorService
*
* @description
* Opens the query builder in infinite editing, the submit callback returns the generted query
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
*/
function queryBuilder(editor) {
editor.view = "views/common/infiniteeditors/querybuilder/querybuilder.html";
editor.size = "small";
open(editor);
}
/**
* @ngdoc method
* @name umbraco.services.editorService#treePicker
* @methodOf umbraco.services.editorService
*
* @description
* Opens the query builder in infinite editing, the submit callback returns the generted query
* @param {Object} editor rendering options
* @param {String} options.section tree section to display
* @param {String} options.treeAlias specific tree to display
* @param {Boolean} options.multiPicker should the tree pick one or multiple items before returning
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
*/
function treePicker(editor) {
editor.view = "views/common/infiniteeditors/treepicker/treepicker.html";
editor.size = "small";
open(editor);
}
/**
* @ngdoc method
* @name umbraco.services.editorService#nodePermissions
* @methodOf umbraco.services.editorService
*
* @description
* Opens the an editor to set node permissions.
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
*/
function nodePermissions(editor) {
editor.view = "views/common/infiniteeditors/nodepermissions/nodepermissions.html";
editor.size = "small";
open(editor);
}
/**
* @ngdoc method
* @name umbraco.services.editorService#insertCodeSnippet
* @methodOf umbraco.services.editorService
*
* @description
* Open an editor to insert code snippets into the code editor
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
*/
function insertCodeSnippet(editor) {
editor.view = "views/common/infiniteeditors/insertcodesnippet/insertcodesnippet.html";
editor.size = "small";
@@ -349,6 +491,7 @@
*
* @description
* Opens the user group picker in infinite editing, the submit callback returns an array of the selected user groups
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
@@ -366,6 +509,7 @@
*
* @description
* Opens the user group picker in infinite editing, the submit callback returns the saved template
* @param {Object} editor rendering options
* @param {String} editor.id The template id
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
@@ -382,7 +526,8 @@
* @methodOf umbraco.services.editorService
*
* @description
* Opens the section picker in infinite editing, the submit callback returns an array of the selected sections
* Opens the section picker in infinite editing, the submit callback returns an array of the selected sections¨
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
@@ -400,6 +545,7 @@
*
* @description
* Opens the insert field editor in infinite editing, the submit callback returns the code snippet
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
@@ -417,6 +563,7 @@
*
* @description
* Opens the template sections editor in infinite editing, the submit callback returns the type to insert
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
@@ -429,11 +576,12 @@
/**
* @ngdoc method
* @name umbraco.services.editorService#sectionPicker
* @name umbraco.services.editorService#userPicker
* @methodOf umbraco.services.editorService
*
* @description
* Opens the section picker in infinite editing, the submit callback returns an array of the selected users
* @param {Object} editor rendering options
* @param {Callback} editor.submit Submits the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
@@ -452,6 +600,7 @@
* @description
* Opens the section picker in infinite editing, the submit callback returns an array of the selected items
*
* @param {Object} editor rendering options
* @param {Array} editor.availableItems Array of available items.
* @param {Array} editor.selectedItems Array of selected items. When passed in the selected items will be filtered from the available items.
* @param {Boolean} editor.filter Set to false to hide the filter.
@@ -485,12 +634,14 @@
/**
* @ngdoc method
* @name umbraco.services.editorService#macroPicker
* @name umbraco.services.editorService#memberGroupPicker
* @methodOf umbraco.services.editorService
*
* @description
* Opens a member group picker in infinite editing.
*
* @param {Object} editor rendering options
* @param {Object} editor.multiPicker Pick one or multiple items.
* @param {Callback} editor.submit Submits the editor.
* @param {Callback} editor.close Closes the editor.
* @returns {Object} editor object