Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 315... Línea 315...
315
 
315
 
316
            // Add the node and select it to replicate the behaviour of execCommand.
316
            // Add the node and select it to replicate the behaviour of execCommand.
317
            selectednode = host.insertContentAtFocusPoint(link.get('outerHTML'));
317
            selectednode = host.insertContentAtFocusPoint(link.get('outerHTML'));
318
            host.setSelection(host.getSelectionFromNode(selectednode));
318
            host.setSelection(host.getSelectionFromNode(selectednode));
-
 
319
        } else {
-
 
320
            if (Y.UA.gecko > 0) {
-
 
321
                // For Firefox / Gecko we need to wrap the selection in a span so we can surround it with an anchor.
-
 
322
                // This relates to https://bugzilla.mozilla.org/show_bug.cgi?id=1906559.
-
 
323
                var originalSelection = document.getSelection();
-
 
324
                var wrapper = document.createElement('span');
-
 
325
                wrapper.setAttribute('data-wrapper', '');
-
 
326
                wrapper.style.display = 'inline';
-
 
327
 
-
 
328
                var i;
-
 
329
                for (i = 0; i < originalSelection.rangeCount; i++) {
-
 
330
                    originalSelection.getRangeAt(i).surroundContents(wrapper);
-
 
331
                }
-
 
332
                host.setSelection(host.getSelectionFromNode(Y.one(wrapper)));
319
        } else {
333
 
-
 
334
                document.execCommand('unlink', false, null);
-
 
335
                document.execCommand('createLink', false, url);
-
 
336
 
-
 
337
                var anchorNode = wrapper.parentNode;
-
 
338
                wrapper.children.forEach(function(child) {
-
 
339
                    anchorNode.appendChild(child);
-
 
340
                });
-
 
341
                wrapper.remove();
-
 
342
 
-
 
343
            } else {
320
            document.execCommand('unlink', false, null);
344
                document.execCommand('unlink', false, null);
-
 
345
                document.execCommand('createLink', false, url);
Línea 321... Línea 346...
321
            document.execCommand('createLink', false, url);
346
            }
322
 
347
 
323
            // Now set the target.
348
            // Now set the target.