Commit 31e32444 authored by codebymikey's avatar codebymikey
Browse files

Issue #3294595 by codebymikey: Address potential issues relating to demo files in the RRule library

parent 0c46c99b
Loading
Loading
Loading
Loading

.editorconfig

0 → 100644
+14 −0
Original line number Diff line number Diff line
# Fullcalendar Block editor configuration normalization
# @see http://editorconfig.org/

# This is the top-most .editorconfig file; do not search in parent directories.
root = true

# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
+49 −36
Original line number Diff line number Diff line
@@ -33,20 +33,20 @@ custom event descriptions in a dialog popup to prevent potential XSS attacks.

As well as support for the Moment (https://fullcalendar.io/docs/moment-plugin) and RRule (https://fullcalendar.io/docs/rrule-plugin) plugins.

By default, all required libraries will be loaded from a CDN (usually https://unpkg.com) automatically.

Please be advised that there is a demo folder (rrule/dist/esm/demo) in the rrule zip file, in which there is a index.html file. You need to delete the demo folder on your server after installing the library via composer or extracting the zip file on your server manually. Unless the library is loaded from CDN which is by default, you don't need to worry about that.
By default, all required libraries will be loaded from a CDN (usually https://unpkg.com) automatically if they could not
be located on disk. A cache clear is typically required following a change in the library states.

INSTALLATION
------------

* Install via Composer.
### COMPOSER INSTALLATION

  You can install this module as a normal installation process of Composer.

  Optionally, if you'd like to automatically install the external libraries into your local Drupal instance, then you may add `drupal/fullcalendar_block` as a `drupal-libraries-dependencies` of the [zodiacmedia/drupal-libraries-installer](https://github.com/zodiacmedia/drupal-libraries-installer#installing-libraries-declared-by-other-packages) plugin.
  * Ensure that packages of type drupal-library are [properly configured to install](https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#s-define-the-directories-to-which-drupal-projects-should-be-downloaded) to the `/libraries` directory.
  * Ensure that packages of type `drupal-library` are [properly configured to install](https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#s-define-the-directories-to-which-drupal-projects-should-be-downloaded) to the `/libraries` directory.
  * Add the composer dependency: `composer require zodiacmedia/drupal-libraries-installer`.
  * Add the library as a dependency:
  * Add the library to the `zodiacmedia/drupal-libraries-installer` Drupal libraries dependencies list:
    ```json
    {
      "extra": {
@@ -59,11 +59,10 @@ INSTALLATION

Then run `composer install` as normal.

* Install via zip file.

### MANUAL INSTALLATION

If you'd like to manually install the external Javascript libraries into your local Drupal instance, you may download and extract the following into your Drupal root directory:
If you are manually installing the module and require the external Javascript libraries to be loaded from your server,
then you may download and extract the following into your Drupal root directory:

| URL                                                                 | Destination                      |
|---------------------------------------------------------------------|----------------------------------|
@@ -76,6 +75,17 @@ If you'd like to manually install the external Javascript libraries into your lo

If the required external libraries are unavailable locally, then **they will be loaded from a CDN** (usually https://unpkg.com).

#### EXTRA FILES

Please be advised that there is a demo folder (`rrule/dist/esm/demo`) in the RRule zip file, in which there is an
`index.html` file (see [PSA-2011-002](https://www.drupal.org/node/1189632)).

And if the libraries are being manually installed, then you should probably delete the `demo` folder on your server
post-installation.

However, if the RRule library is being loaded from the CDN or composer (with integration with the
`zodiacmedia/drupal-libraries-installer` plugin), then you do not need to worry about this step.

CONFIGURATION
-------------

@@ -83,14 +93,16 @@ CONFIGURATION
2. Click the 'Place block' button in the area you want the calendar block take place.
3. In the pop-up dialog search 'FullCalendar block' and then place the block.
4. Click the 'Configure' button of the block to set up the block.
5. The 'Event source URL' is mandatory which is the JSON feed URL providing the event data of the calendar.
5. The 'Event source URL' is a mandatory field pointing to the JSON feed URL providing the event data of the calendar.
   This can be a relative path to internal pages such as a Drupal "REST export" views, custom Controllers, or an
   absolute URL pointing to another external event data provider.
6. The 'Advanced settings' provides the capability to add or modify any options of the FullCalendar, which has to be valid JSON/YAML format text. For example, following will set the initial date at 2022-05-01,

   ```yaml
   initialDate: '2022-05-01'
   ```

8. The 'Advanced Drupal settings' provides support for more advanced Fullcalendar behaviour relating to the dialog, which has to be valid JSON/YAML format text. Available options are as follows:
7. The 'Advanced Drupal settings' provides support for more advanced Fullcalendar behaviour relating to the dialog, which has to be valid JSON/YAML format text. Available options are as follows:
   ```yaml
   # The dialog modal type.
   dialog_type: 'modal'
@@ -118,33 +130,35 @@ CONFIGURATION

DEVELOPMENT
-------------
1. During development, you may switch to non-minified assets by specifying the following in your local `settings.php` and clearing the Drupal cache:
1. During development, you may switch to non-minified assets by specifying the following in your local
   `settings.php` and clearing the Drupal cache:

    ```php
    // Enable non-minified assets.
    $settings['fullcalendar_block.dev_mode'] = TRUE;
    ```

2. There is a hook called 'hook_fullcalendar_block_settings_alter' for other modules to modify the block settings, includeing the calendar options.
More details about this hook see 
2. There is a hook called `hook_fullcalendar_block_settings_alter` for other modules to modify the block settings,
   including the calendar options. For more details about this hook see:
   https://git.drupalcode.org/project/fullcalendar_block/-/blob/1.0.x/fullcalendar_block.api.php

3. JavaScript events.
 - fullcalendar_block.beforebuild
   - `fullcalendar_block.beforebuild`
     An event to let other modules know that a calendar will be built.
     Parameters:
      - event
        The event object.
      - calendarOptions
        The calendar opetions object.
     - `event`: The event object.
     - `calendarOptions`: The calendar options object.

 - fullcalendar_block.build
   - `fullcalendar_block.build`
     An event to let other modules know when a calendar has been built.
     Parameters:
    - event
        The event object.
    - blockInstance
        The block instance object.
     - `event`: The event object.
     - `blockInstance`: The block instance object containing
       - `element`: The fullcalendar block DOM element.
       - `index`: The fullcalendar block index.
       - `calendar`: The Fullcalendar instance.
       - `calendarOptions`: The calendar options object.
       - `blockSettings`: The block settings object.

FEATURES:
-------------
@@ -153,4 +167,3 @@ FEATURES:
* Support simple recurring events out of box.
* Support loading events via Ajax once needed.
* Support the moment and RRule fullcalendar plugins
+6 −1
Original line number Diff line number Diff line
@@ -25,7 +25,12 @@
      "DOMPurify": "https://registry.npmjs.org/dompurify/-/dompurify-2.3.8.tgz",
      "drupal-fullcalendar": "https://registry.npmjs.org/fullcalendar/-/fullcalendar-5.11.0.tgz",
      "moment": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
      "rrule": "https://registry.npmjs.org/rrule/-/rrule-2.7.0.tgz",
      "rrule": {
        "url": "https://registry.npmjs.org/rrule/-/rrule-2.7.0.tgz",
        "ignore": [
          "dist/esm/demo"
        ]
      },
      "fullcalendar-rrule": "https://registry.npmjs.org/@fullcalendar/rrule/-/rrule-5.11.0.tgz",
      "fullcalendar-moment": "https://registry.npmjs.org/@fullcalendar/moment/-/moment-5.11.0.tgz"
    }
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@
              index: blockIndex,
              calendar: calendar,
              calendarOptions: calendarOptions,
              blockSettings,
              blockSettings: blockSettings,
            };
            // Trigger an event to let other modules know when a calendar
            // has been built.