@rmdes/indiekit-endpoint-posts 1.0.1 → 1.1.1

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.
@@ -4,6 +4,7 @@
4
4
  label: __("posts.form.category.label"),
5
5
  hint: __("posts.form.category.hint"),
6
6
  optional: not field.required,
7
+ attributes: { "data-suggestions": application.micropubEndpoint + "?q=category" } if application.micropubEndpoint else {},
7
8
  localisation: {
8
9
  tag: __("posts.form.category.tag"),
9
10
  tags: __("posts.form.category.label") | lower
@@ -97,9 +97,9 @@ export const formController = {
97
97
  // Easy MDE appends `image` value to formData for last image uploaded
98
98
  delete values.image;
99
99
 
100
- // Remove empty layout selection (user chose "Default")
101
- if (!values.layout) {
102
- delete values.layout;
100
+ // Remove empty layout-intent selection (user chose "Site default")
101
+ if (!values["layout-intent"]) {
102
+ delete values["layout-intent"];
103
103
  }
104
104
 
105
105
  // Remove empty pinned/featured flag
@@ -5,7 +5,6 @@ import { IndiekitError } from "@indiekit/error";
5
5
  import { statusTypes } from "../status-types.js";
6
6
  import {
7
7
  getGeoValue,
8
- getLayoutItems,
9
8
  getPostName,
10
9
  getPostProperties,
11
10
  getSyndicateToItems,
@@ -55,7 +54,6 @@ export const postData = {
55
54
  accessToken: access_token,
56
55
  action: "create",
57
56
  fields,
58
- layoutItems: getLayoutItems(publication),
59
57
  name,
60
58
  postsPath: path.dirname(request.baseUrl + request.path),
61
59
  postType,
@@ -97,7 +95,6 @@ export const postData = {
97
95
  fields,
98
96
  geo,
99
97
  h,
100
- layoutItems: getLayoutItems(publication),
101
98
  name,
102
99
  postName: getPostName(publication, properties),
103
100
  postsPath: path.dirname(request.baseUrl + request.path),
package/lib/utils.js CHANGED
@@ -9,25 +9,6 @@ import formatcoords from "formatcoords";
9
9
  import { endpoint } from "./endpoint.js";
10
10
  import { statusTypes } from "./status-types.js";
11
11
 
12
- /**
13
- * Get layout `items` for select component
14
- * @param {object} publication - Publication configuration
15
- * @returns {Array} Items for select component, or empty array if no layouts configured
16
- */
17
- export const getLayoutItems = (publication) => {
18
- if (!publication.layouts || !Array.isArray(publication.layouts)) {
19
- return [];
20
- }
21
-
22
- return [
23
- { text: "Default", value: "", selected: true },
24
- ...publication.layouts.map((layout) => ({
25
- text: layout.name,
26
- value: layout.path,
27
- })),
28
- ];
29
- };
30
-
31
12
  /**
32
13
  * Get geographic coordinates property
33
14
  * @param {string} geo - Latitude and longitude, comma separated
package/locales/en.json CHANGED
@@ -113,6 +113,13 @@
113
113
  "layout": {
114
114
  "label": "Layout"
115
115
  },
116
+ "layout-intent": {
117
+ "label": "Layout width",
118
+ "hint": "Controls how wide this post renders. Leave unset to use your site’s configured default.",
119
+ "default": "Site default",
120
+ "fullwidth": "Full width",
121
+ "minimal": "Minimal (narrow reading column)"
122
+ },
116
123
  "mp-slug": {
117
124
  "label": "URL slug"
118
125
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-posts",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Post management endpoint for Indiekit with syndicate form fix. View posts published by your Micropub endpoint and publish new posts to it.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -98,22 +98,17 @@
98
98
  optional: true
99
99
  }) | indent(4) }}
100
100
 
101
- {% if layoutItems and layoutItems.length %}
102
- {% set layoutSelectItems = [] %}
103
- {% for item in layoutItems %}
104
- {% set _ = layoutSelectItems.push({
105
- text: item.text,
106
- value: item.value,
107
- selected: item.value === properties.layout
108
- }) %}
109
- {% endfor %}
110
101
  {{ select({
111
- name: "layout",
112
- label: __("posts.form.layout.label"),
102
+ name: "layout-intent",
103
+ label: __("posts.form.layout-intent.label"),
104
+ hint: __("posts.form.layout-intent.hint"),
113
105
  optional: true,
114
- items: layoutSelectItems
106
+ items: [
107
+ { text: __("posts.form.layout-intent.default"), value: "", selected: not properties["layout-intent"] },
108
+ { text: __("posts.form.layout-intent.fullwidth"), value: "fullwidth", selected: properties["layout-intent"] === "fullwidth" },
109
+ { text: __("posts.form.layout-intent.minimal"), value: "minimal", selected: properties["layout-intent"] === "minimal" }
110
+ ]
115
111
  }) | indent(4) }}
116
- {% endif %}
117
112
 
118
113
  {{ select({
119
114
  name: "pinned",