', {
- 'class': 'aloha-surface aloha-toolbar',
- 'unselectable': 'on'
- })
- .append(Toolbar.$handlesSurfaceContainer)
- .append(Toolbar.$panelsSurfaceContainer)
- .hide();
- Toolbar.$handlesSurfaceContainer.removeClass('aloha-surface').show();
- Toolbar.$panelsSurfaceContainer.removeClass('aloha-surface').show();
- }
+
+ Toolbar.$toolbarSurfaceContainer = $('
', {
+ 'class': 'aloha-surface aloha-toolbar',
+ 'unselectable': 'on'
+ })
+ .append(Toolbar.$handlesSurfaceContainer)
+ .append(Toolbar.$panelsSurfaceContainer)
+ .hide();
+ Toolbar.$handlesSurfaceContainer.removeClass('aloha-surface').show();
+ Toolbar.$panelsSurfaceContainer.removeClass('aloha-surface').show();
// In the built aloha.js, init will happend before the body has
// finished loading, so we have to defer appending the element.
$(function () {
- if (Toolbar.renderOwnToolbarContainer) {
- Toolbar.$toolbarSurfaceContainer.appendTo('body');
- }
- else {
- Toolbar.$panelsSurfaceContainer.appendTo('body');
- Toolbar.$handlesSurfaceContainer.appendTo('body');
- }
+ Toolbar.$toolbarSurfaceContainer.appendTo('body');
});
- if (Toolbar.renderOwnToolbarContainer) {
- Surface.trackRange(Toolbar.$toolbarSurfaceContainer);
- }
- else {
- Surface.trackRange(Toolbar.$panelsSurfaceContainer);
- Surface.trackRange(Toolbar.$handlesSurfaceContainer);
- }
+ Surface.trackRange(Toolbar.$toolbarSurfaceContainer);
+
+ // Unnecessary when the UI renders itself completely, but essential when
+ // the toolbar must be rendered into a custom location.
+ Surface.trackRange(Toolbar.$panelsSurfaceContainer);
+ Surface.trackRange(Toolbar.$handlesSurfaceContainer);
}
});
diff --git a/caption/caption.module b/caption/caption.module
index d83b465..c86a8c5 100644
--- a/caption/caption.module
+++ b/caption/caption.module
@@ -45,7 +45,7 @@ function caption_library_info() {
// we can target it with our custom CSS.
'blockClass' => 'caption-captioned-image-block',
// Function callback, gets set in `js/caption-aloha.js`.
- // 'render' => function() {},
+ // 'render' => function() {},
),
),
'contentHandler' => array(
@@ -105,8 +105,6 @@ function caption_library_info_alter(&$libraries, $module) {
* Implements hook_init().
*/
function caption_init() {
- // @todo: we should only add this when the caption filter was actually used,
- // but there is currently no elegant way to do this in Drupal 7 or 8.
drupal_add_library('caption', 'caption', TRUE);
}
diff --git a/css/aloha-drupal-ui.css b/css/aloha-drupal-ui.css
index 62625c6..0600b7f 100644
--- a/css/aloha-drupal-ui.css
+++ b/css/aloha-drupal-ui.css
@@ -406,8 +406,11 @@
* Custom UI for common/block.
*/
-/* @todo Temporarily disable Aloha Blocks' handles, because the CaptionedImage
- plug-in can't deal yet with dragging images into an alignment. */
+/*
+ * @todo POST_COMMIT(Aloha Editor, https://github.com/alohaeditor/Aloha-Editor/issues/685)
+ * Temporarily disable Aloha Blocks' handles, because the CaptionedImage plug-in
+ * can't deal yet with dragging images into an alignment.
+ */
.aloha-block-handle {
background: none;
border: none;
diff --git a/generate-core-patch.sh b/generate-core-patch.sh
index 9367ffe..ebf6d9d 100644
--- a/generate-core-patch.sh
+++ b/generate-core-patch.sh
@@ -18,7 +18,7 @@ COMMENTNR=$2
mkdir $DRUPAL_DIR/core/modules/aloha
# Generate the patch for the Aloha module.
-cp -R aloha aloha.* css fonts includes js README.txt $DRUPAL_DIR/core/modules/aloha/
+cp -R aloha aloha.* css fonts includes js $DRUPAL_DIR/core/modules/aloha/
cd $DRUPAL_DIR
git add core/modules/aloha
git diff --staged --binary --patch-with-stat > $ALOHA_DIR/$FILENAME-aloha-module-$COMMENTNR.patch
diff --git a/includes/format.inc b/includes/format.inc
deleted file mode 100644
index ddf1146..0000000
--- a/includes/format.inc
+++ /dev/null
@@ -1,153 +0,0 @@
- 'p',
- // For a single
that would be stripped, filter_autop would generate
- // it again, making it impossible to detect that filter_html actually
- // stripped it away. Hence we need to use two adjacent
tags.
- 'testcase' => '
Hello, world!
This is Drupal!
',
- 'attributes' => array(
- 'prefix' => '
'>Hello, world!
',
- 'names' => array('dir'),
- ),
- ),
- array(
- 'tag' => 'blockquote',
- 'testcase' => '
Veni, vidi, vici.
',
- 'attributes' => array(
- 'prefix' => '
'>Veni, vidi, vici!
',
- 'names' => array('cite'),
- ),
- ),
- array('tag' => 'h1', 'testcase' => '
heading 1
'),
- array('tag' => 'h2', 'testcase' => '
heading 2
'),
- array('tag' => 'h3', 'testcase' => '
heading 3
'),
- array('tag' => 'h4', 'testcase' => '
heading 4
'),
- array('tag' => 'h5', 'testcase' => '
heading 5
'),
- array('tag' => 'h6', 'testcase' => '
heading 6
'),
- array('tag' => 'ul', 'testcase' => '
'),
- array('tag' => 'ol', 'testcase' => '
- A
- B
'),
- array('tag' => 'li', 'testcase' => '
A'),
- array('tag' => 'pre', 'testcase' => '
preformatted text
'),
- // Text-level elements. (Should all be wrapped in
tags.)
- array(
- 'tag' => 'a',
- 'testcase' => '
hyperlink
',
- 'attributes' => array(
- 'prefix' => '
'>hyperlink
',
- 'names' => array('href', 'target', 'rel', 'media'),
- ),
- ),
- array('tag' => 'em', 'testcase' => '
emphasized
'),
- array('tag' => 'strong', 'testcase' => '
strong
'),
- array('tag' => 'i', 'testcase' => '
italicized
'),
- array('tag' => 'b', 'testcase' => '
bold
'),
- array('tag' => 'u', 'testcase' => '
underlined
'),
- array('tag' => 'cite', 'testcase' => '
He said "WOW, Drupal rocks!"
'),
- array('tag' => 'q', 'testcase' => '
He said "WOW, Drupal rocks!"
'),
- array('tag' => 'br', 'testcase' => '
First line
Second line
'),
- array(
- 'tag' => 'code',
- 'testcase' => '
Hello, world!
',
- 'attributes' => array(
- 'prefix' => '
'>Hello, world!
',
- 'names' => array('lang'),
- ),
- ),
- array(
- 'tag' => 'img',
- 'testcase' => '
![]()
',
- 'attributes' => array(
- 'prefix' => '
' />
',
- 'names' => array('src', 'alt', 'title')
- ),
- ),
- );
-}
-
-/**
- * Calculates the allowed HTML tags.
- *
- * @param string $format_id
- * A text format ID.
- * @return
- * @see aloha_get_allowed_html_by_format()
- *
- * @todo Refactor.
- * @todo Unit tests. Start from http://drupal.org/node/1782838#comment-6562024.
- */
-function _aloha_calculate_allowed_html($format_id) {
- // For testing whether any attribute is allowed.
- $any = 'thisIsAnExtremelyUnlikelyToExistAttributeName';
-
- // For testing whether data- attributes are allowed.
- $data = 'data-' . chr(mt_rand(65, 90));
-
- // Helper function to assert the filtered text still contains the original.
- $assert_match = function ($original, $format_id) {
- $filtered = check_markup($original, $format_id);
- $result = preg_replace("/>\s+", "><", $filtered);
- return stripos($result, $original) !== FALSE;
- };
-
- // Run all the above tagtests to determine which tags and attributes are
- // allowed in the given text format.
- $allowed_html = array_reduce(
- _aloha_allowed_html_tests(),
- function($result, $tagtest) use ($assert_match, $format_id, $any, $data) {
- $tag = $tagtest['tag'];
- if ($assert_match($tagtest['testcase'], $format_id)) {
- $result[$tag] = array();
-
- // Break early if there are no attributes to test.
- if (!isset($tagtest['attributes'])) {
- return $result;
- }
-
- // Anonymous function to generate attribute test cases.
- $generate_attr_testcase = function($attr) use ($tagtest) {
- $case = '';
- $case .= $tagtest['attributes']['prefix'];
- $case .= $attr . '="' . $attr . ' attribute test"';
- $case .= $tagtest['attributes']['suffix'];
- return $case;
- };
-
- // The tag test passed, then we can also do the attribute tests. First,
- // check if any attribute is allowed, if that's not the case, then
- // figure out which specific attributes are allowed.
- if ($assert_match($generate_attr_testcase($any), $format_id)) {
- $result[$tag][] = '*';
- }
- else {
- $attrs = array_merge(array($data), $tagtest['attributes']['names']);
- foreach ($attrs as $attr) {
- if ($assert_match($generate_attr_testcase($attr), $format_id)) {
- $result[$tag][] = ($attr === $data) ? 'data-' : $attr;
- }
- }
- }
- }
-
- return $result;
- },
- array()
- );
-
- return $allowed_html;
-}
diff --git a/includes/pages.inc b/includes/pages.inc
deleted file mode 100644
index a27422d..0000000
--- a/includes/pages.inc
+++ /dev/null
@@ -1,68 +0,0 @@
- $result['link'],
- 't' => $result['title'],
- 's' => $result['score'],
- );
- }
- print drupal_json_encode($json);
- exit;
- }
-}
-
-/**
- * Page callback: looks up relevant images in the site given a keyword.
- *
- * Note that also files with status = 0 are returned, i.e. those who were
- * uploaded at some point in time, but not necessarily used.
- *
- * @param string $lookup
- * The keyword to look up relevant images for.
- *
- * @return string
- * A JSON-encoded result.
- */
-function aloha_repository_image($lookup) {
- $result = db_query("SELECT * FROM {file_managed} WHERE SUBSTRING(filemime, 1, 6) = 'image/' AND filename LIKE :lookup ORDER BY timestamp DESC", array(
- ':lookup' => "%$lookup%"
- ));
-
- $json = array();
- foreach ($result as $record) {
- $json[] = array(
- 'u' => file_create_url($record->uri),
- 't' => $record->filename,
- 's' => 1.0,
- );
- }
-
- print drupal_json_encode($json);
- exit;
-}
diff --git a/js/drupal.aloha.js b/js/drupal.aloha.js
index c159ae3..f170533 100644
--- a/js/drupal.aloha.js
+++ b/js/drupal.aloha.js
@@ -211,7 +211,7 @@ Drupal.aloha = {
// Populate the div with the value of the textarea and hide the textarea.
$div
- .css('height', $editable.height()) // @todo: make the height of the div resizable, like it is for textareas.
+ .css('height', $editable.height())
.html($editable.val());
$editable.hide();
}