pages_core 3.8.1 → 3.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,8 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import copyToClipboard from "../../lib/copyToClipboard";
4
4
  import AttachmentEditor from "./AttachmentEditor";
5
- import ModalStore from "../ModalStore";
6
- import ToastStore from "../ToastStore";
5
+ import ModalStore from "../../stores/ModalStore";
6
+ import ToastStore from "../../stores/ToastStore";
7
7
 
8
8
  import { useDraggable } from "../drag";
9
9
 
@@ -1,8 +1,8 @@
1
1
  import React, { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import copyToClipboard, { copySupported } from "../../lib/copyToClipboard";
4
- import ModalStore from "../ModalStore";
5
- import ToastStore from "../ToastStore";
4
+ import ModalStore from "../../stores/ModalStore";
5
+ import ToastStore from "../../stores/ToastStore";
6
6
  import { putJson } from "../../lib/request";
7
7
 
8
8
  export default function AttachmentEditor(props) {
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import ImageEditor from "./ImageEditor";
4
- import ModalStore from "./ModalStore";
4
+ import ModalStore from "../stores/ModalStore";
5
5
 
6
6
  export default function EditableImage(props) {
7
7
  const [image, setImage] = useState(props.image);
@@ -1,49 +1,42 @@
1
- import React from "react";
1
+ import React, { useRef } from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
- export default class FileUploadButton extends React.Component {
5
- constructor(props) {
6
- super(props);
7
- this.inputRef = React.createRef();
8
- this.handleChange = this.handleChange.bind(this);
9
- this.triggerDialog = this.triggerDialog.bind(this);
10
- }
4
+ export default function FileUploadButton(props) {
5
+ const inputRef = useRef();
11
6
 
12
- handleChange(evt) {
7
+ const handleChange = (evt) => {
13
8
  let fileList = evt.target.files;
14
9
  let files = [];
15
10
  for (var i = 0; i < fileList.length; i++) {
16
11
  files.push(fileList[i]);
17
12
  }
18
13
  if (files.length > 0) {
19
- this.props.callback(files);
14
+ props.callback(files);
20
15
  }
21
- }
16
+ };
22
17
 
23
- render() {
24
- return (
25
- <div className="upload-button">
26
- <span>
27
- Drag and drop {this.props.type || "file"}
28
- {this.props.multiple && "s"} here, or
29
- {this.props.multiline && <br />}
30
- <button onClick={this.triggerDialog}>
31
- choose a file
32
- </button>
33
- </span>
34
- <input type="file"
35
- onChange={this.handleChange}
36
- ref={this.inputRef}
37
- style={{ display: "none" }}
38
- multiple={this.props.multiple || false} />
39
- </div>
40
- );
41
- }
42
-
43
- triggerDialog(evt) {
18
+ const triggerDialog = (evt) => {
44
19
  evt.preventDefault();
45
- this.inputRef.current.click();
46
- }
20
+ inputRef.current.click();
21
+ };
22
+
23
+ return (
24
+ <div className="upload-button">
25
+ <span>
26
+ Drag and drop {props.type || "file"}
27
+ {props.multiple && "s"} here, or
28
+ {props.multiline && <br />}
29
+ <button onClick={triggerDialog}>
30
+ choose a file
31
+ </button>
32
+ </span>
33
+ <input type="file"
34
+ onChange={handleChange}
35
+ ref={inputRef}
36
+ style={{ display: "none" }}
37
+ multiple={props.multiple || false} />
38
+ </div>
39
+ );
47
40
  }
48
41
 
49
42
  FileUploadButton.propTypes = {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import ModalStore from "../ModalStore";
4
- import ToastStore from "../ToastStore";
3
+ import ModalStore from "../../stores/ModalStore";
4
+ import ToastStore from "../../stores/ToastStore";
5
5
  import copyToClipboard, { copySupported } from "../../lib/copyToClipboard";
6
6
 
7
7
  export default function Form(props) {
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
- import ModalStore from "./ModalStore";
3
+ import ModalStore from "../stores/ModalStore";
4
4
  import { putJson } from "../lib/request";
5
5
 
6
6
  import ImageCropper, { useCrop, cropParams } from "./ImageCropper";
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import copyToClipboard from "../../lib/copyToClipboard";
4
4
  import EditableImage from "../EditableImage";
5
- import ToastStore from "../ToastStore";
5
+ import ToastStore from "../../stores/ToastStore";
6
6
  import Placeholder from "./Placeholder";
7
7
 
8
8
  import { useDraggable } from "../drag";
@@ -4,7 +4,7 @@ import FileUploadButton from "./FileUploadButton";
4
4
  import DragElement from "./ImageGrid/DragElement";
5
5
  import FilePlaceholder from "./ImageGrid/FilePlaceholder";
6
6
  import GridImage from "./ImageGrid/GridImage";
7
- import ToastStore from "./ToastStore";
7
+ import ToastStore from "../stores/ToastStore";
8
8
  import { post } from "../lib/request";
9
9
 
10
10
  import { createDraggable,
@@ -2,7 +2,7 @@ import React, { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import EditableImage from "./EditableImage";
4
4
  import FileUploadButton from "./FileUploadButton";
5
- import ToastStore from "./ToastStore";
5
+ import ToastStore from "../stores/ToastStore";
6
6
  import { post } from "../lib/request";
7
7
 
8
8
  function getFiles(dt) {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import ModalStore from "./ModalStore";
2
+ import ModalStore from "../stores/ModalStore";
3
3
 
4
4
  export default class Modal extends React.Component {
5
5
  constructor(props) {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import ToastStore from "./ToastStore";
3
+ import ToastStore from "../stores/ToastStore";
4
4
 
5
5
  export default class Toast extends React.Component {
6
6
  constructor(props) {
@@ -1,6 +1,7 @@
1
1
  export { default as Attachments } from "./components/Attachments";
2
2
  export { default as DateRangeSelect } from "./components/DateRangeSelect";
3
3
  export { default as EditableImage } from "./components/EditableImage";
4
+ export { default as FileUploadButton } from "./components/FileUploadButton";
4
5
  export { default as ImageCropper } from "./components/ImageCropper";
5
6
  export { default as ImageGrid } from "./components/ImageGrid";
6
7
  export { default as ImageUploader } from "./components/ImageUploader";
@@ -31,6 +31,7 @@ export default function startPages () {
31
31
 
32
32
  export * from "./components";
33
33
  export * from "./hooks";
34
+ export * from "./stores";
34
35
 
35
36
  export * from "./lib/request.js";
36
37
  export { default as copyToClipboard,
@@ -0,0 +1,2 @@
1
+ export { default as ModalStore } from "./stores/ModalStore";
2
+ export { default as ToastStore } from "./stores/ToastStore";
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PagesCore
4
- VERSION = "3.8.1" unless PagesCore.const_defined?("VERSION")
4
+ VERSION = "3.8.2" unless PagesCore.const_defined?("VERSION")
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pages_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.1
4
+ version: 3.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
@@ -621,7 +621,6 @@ files:
621
621
  - app/javascript/components/ImageGrid/Placeholder.jsx
622
622
  - app/javascript/components/ImageUploader.jsx
623
623
  - app/javascript/components/Modal.jsx
624
- - app/javascript/components/ModalStore.jsx
625
624
  - app/javascript/components/PageDates.jsx
626
625
  - app/javascript/components/PageFiles.jsx
627
626
  - app/javascript/components/PageImages.jsx
@@ -634,7 +633,6 @@ files:
634
633
  - app/javascript/components/TagEditor/AddTagForm.jsx
635
634
  - app/javascript/components/TagEditor/Tag.jsx
636
635
  - app/javascript/components/Toast.jsx
637
- - app/javascript/components/ToastStore.jsx
638
636
  - app/javascript/components/drag.js
639
637
  - app/javascript/components/drag/draggedOrder.js
640
638
  - app/javascript/components/drag/useDragCollection.js
@@ -651,6 +649,9 @@ files:
651
649
  - app/javascript/lib/copyToClipboard.js
652
650
  - app/javascript/lib/readyHandler.js
653
651
  - app/javascript/lib/request.js
652
+ - app/javascript/stores.js
653
+ - app/javascript/stores/ModalStore.jsx
654
+ - app/javascript/stores/ToastStore.jsx
654
655
  - app/jobs/pages_core/autopublish_job.rb
655
656
  - app/jobs/pages_core/sweep_cache_job.rb
656
657
  - app/mailers/admin_mailer.rb